Closed (fixed)
Project:
Single Content Sync
Version:
1.4.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
19 Mar 2024 at 00:10 UTC
Updated:
27 Jul 2026 at 19:45 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
vensiresComment #3
kyriazo commentedComment #4
kyriazo commentedTested on Drupal 10.2 with php 8.2 and works correctly. Can you give more feedback in order to reproduce the issue? Can you reproduce it on a clean environment?
Comment #5
megakeegman commentedYes. The issue is that the uuid of the admin user is different between instances, so it tries to create a new user with the same name. So I guess I could just update the uuid to reflect the admin on the separate instance. Just a minor inconvenience.
Comment #6
megakeegman commentedI am trying to use this to generate default content for a distribution though. I could write a script that gets the uuid of the admin, updates the uuid in each default content zip, and then imports. But I guess the alternative is whether the import needs to respect the uuid of the referenced user, or if it could just infer that information based on the user with the given username. Any different ideas or suggestions?
Comment #7
megakeegman commentedMaybe a big ask but a token would be cool
Comment #8
nginex commentedI think this should be improved in doImport() method, at least we can have an extra validation by loading users by email and username if entity by uuid was not found. I will provide a patch, once it's available, there will be nothing to do on your side, I'm also planning to provide a new release soon, so the patch will be included to the new release immediately
Comment #9
nginex commentedComment #10
uri_frazierI'm running into the same type of error, but in involves a complex node bundle type with a lot of fields.
Drupal\Core\Entity\EntityStorageException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'e72b42aa-af28-4aeb-80c3-4cb1e4e20ed8' for key 'paragraph_field__uuid__value': INSERT INTO "paragraphs_item" ("revision_id", "type", "uuid", "langcode") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array ( [:db_insert_placeholder_0] => [:db_insert_placeholder_1] => accordion [:db_insert_placeholder_2] => e72b42aa-af28-4aeb-80c3-4cb1e4e20ed8 [:db_insert_placeholder_3] => en ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 817 of /mnt/alidata/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).Comment #13
dlevchik commentedAdded check, if it is a user import, try to find it by properties, not only by uuid
But I think now, should it be only for a user? Right after loadEntityByUuid failed, we can do something like dispatch FindExistingEntity event, with content and entity type/storage, and modules can subscribe to it to fix those "Duplicate entry" messages. This should not be limited to the user, as user is only one of examples
Comment #14
nginex commentedComment #15
borg_git commentedChecked on the original code.
I created several taxonomy terms with references to users
exported, deleted terms and imported in various ways (via file and drush).
I was unable to reproduce any errors.
Drupal core version 10.2.6
Single Content Sync 1.4.8
Comment #16
nginex commentedFor user entity I would definitely try to find a user by username if no match by uuid.
The issue is that user entity should have a unique username and if user A was create on site A and the same user was manually created on site B, they do have different uuid but the same username
Comment #17
du_paludo commentedI'm attaching an updated patch for the branch 1.4.x.
Comment #18
nginex commentedComment #20
nginex commented