Safe Import: Integrity constraint violation - Duplicate entry

Created on 17 March 2025, 22 days ago

Using Drupal 9.5.11, PHP 8.1.31, MySQL 8.0.40.

When doing a safe import for terms it throws an error because of duplicate entry:

 [error]  Drupal\Core\Database\IntegrityConstraintViolationException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '5c30cca2-a394-49a6-9cd1-cb59afe435e7' for key 'wlie_taxonomy_term_data.taxonomy_term_field__uuid__value': INSERT INTO "wlie_taxonomy_term_data" ("revision_id", "vid", "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] => resource_type_2024
    [:db_insert_placeholder_2] => 5c30cca2-a394-49a6-9cd1-cb59afe435e7
    [:db_insert_placeholder_3] => en
)
 in Drupal\mysql\Driver\Database\mysql\ExceptionHandler->handleExecutionException() (line 50 of /app/MYSITE/web/core/modules/mysql/src/Driver/Database/mysql/ExceptionHandler.php). 

In SqlContentEntityStorage.php line 815:

  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '5c30cca2-a394-49a6-9cd1-cb59afe435e7' for key 'wlie_taxonomy_term_data.ta   xonomy_term_field__uuid__value': INSERT INTO "wlie_taxonomy_term_data" ("revision_id", "vid", "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] => resource_type_2024                                                                                               
      [:db_insert_placeholder_2] => 5c30cca2-a394-49a6-9cd1-cb59afe435e7                                                                             
      [:db_insert_placeholder_3] => en                                                                                                               
  )                                                                                                                                                  
                                                                                                                                                     

In ExceptionHandler.php line 50:
                                                                                                                                                     
  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '5c30cca2-a394-49a6-9cd1-cb59afe435e7' for key 'wlie_taxonomy_term_data.taxonomy_term_field__uuid__value': INSERT INTO "wlie_taxonomy_term_data" ("revision_id", "vid", "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] => resource_type_2024                                                                                               
      [:db_insert_placeholder_2] => 5c30cca2-a394-49a6-9cd1-cb59afe435e7                                                                             
      [:db_insert_placeholder_3] => en                                                                                                               
  )                                                                                                                                                  
                                                                                                                                                     

In StatementWrapper.php line 145:
                                                                                                                                                     
  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '5c30cca2-a394-49a6-9cd1-cb59afe435e7' for key 'wlie_taxonomy_term_data.taxonomy_term_field__uuid__value'                                                                                                                    

Works fine if I do a full import.

This appears to be similar to this issue which was closed and marked outdated: https://www.drupal.org/project/structure_sync/issues/3200853 ✨ Dublicate entry error message, if a entry exists Closed: outdated

πŸ› Bug report
Status

Active

Version

2.0

Component

Miscellaneous

Created by

πŸ‡ΊπŸ‡ΈUnited States fallenturtle

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @fallenturtle
  • πŸ‡¦πŸ‡ΊAustralia demma10

    I had this same issue on my site, but with the full import instead of the safety import.

    In my case it was the tac_lite module that was causing a conflict with the taxonomy import. Once I disabled tac_lite I could taxonomy terms without any errors (I still used the full import though).

Production build 0.71.5 2024