Duplicate entry '[UUID]' for key 'media_field__uuid__value'

Created on 17 March 2021, over 3 years ago
Updated 29 September 2023, 9 months ago

I honestly have no idea if this is actually an issue with my config or a problem with this module because there is effectively no documentation on using this in the context of a custom migration as opposed to allowing migrate_upgrade to generate the whole thing. I'm migrating one content type (blog) and a bunch of file entities over from a Drupal 7 site into a new D9 site (this is part of a larger rebranding of the organization, so not just an upgrade). I've attached my config as it currently stands.

The problem is that the media migration throws a bunch of these, though most do migrate:

 [error]  Drupal\Core\Database\IntegrityConstraintViolationException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '3bac1a16-ca70-426f-a401-5f15640c6dff' for key 'media_field__uuid__value': INSERT INTO {media} ("vid", "bundle", "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] => image
    [:db_insert_placeholder_2] => 3bac1a16-ca70-426f-a401-5f15640c6dff
    [:db_insert_placeholder_3] => en
)
 in Drupal\Core\Database\Connection->handleQueryException() (line 893 of /app/web/core/lib/Drupal/Core/Database/Connection.php).
 [error]  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '3bac1a16-ca70-426f-a401-5f15640c6dff' for key 'media_field__uuid__value': INSERT INTO {media} ("vid", "bundle", "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] => image
    [:db_insert_placeholder_2] => 3bac1a16-ca70-426f-a401-5f15640c6dff
    [:db_insert_placeholder_3] => en
)
 (/app/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:810)
 [error]  Drupal\Core\Database\IntegrityConstraintViolationException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '6fe5d972-8d92-4c39-b366-0d9dc3f5d81c' for key 'media_field__uuid__value': INSERT INTO {media} ("vid", "bundle", "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] => image
    [:db_insert_placeholder_2] => 6fe5d972-8d92-4c39-b366-0d9dc3f5d81c
    [:db_insert_placeholder_3] => en
)
 in Drupal\Core\Database\Connection->handleQueryException() (line 893 of /app/web/core/lib/Drupal/Core/Database/Connection.php).
 [error]  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '6fe5d972-8d92-4c39-b366-0d9dc3f5d81c' for key 'media_field__uuid__value': INSERT INTO {media} ("vid", "bundle", "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] => image
    [:db_insert_placeholder_2] => 6fe5d972-8d92-4c39-b366-0d9dc3f5d81c
    [:db_insert_placeholder_3] => en
)
 (/app/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:810)
 [error]  Drupal\Core\Database\IntegrityConstraintViolationException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '78567e2c-a855-4b8a-802b-f3d528d2e595' for key 'media_field__uuid__value': INSERT INTO {media} ("vid", "bundle", "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] => image
    [:db_insert_placeholder_2] => 78567e2c-a855-4b8a-802b-f3d528d2e595
    [:db_insert_placeholder_3] => en
)
 in Drupal\Core\Database\Connection->handleQueryException() (line 893 of /app/web/core/lib/Drupal/Core/Database/Connection.php).
 [error]  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '78567e2c-a855-4b8a-802b-f3d528d2e595' for key 'media_field__uuid__value': INSERT INTO {media} ("vid", "bundle", "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] => image
    [:db_insert_placeholder_2] => 78567e2c-a855-4b8a-802b-f3d528d2e595
    [:db_insert_placeholder_3] => en
)
 (/app/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:810)

Quite a few more of those, followed by this:

[notice] Processed 184 items (166 created, 0 updated, 18 failed, 0 ignored) - done with 'yeegoconnect_migrate_d7_file_entity_image_public'

In MigrateToolsCommands.php line 869:

  yeegoconnect_migrate_d7_file_entity_image_public Migration - 18 failed.

If run it as part of a group import via drush, those errors stop the migration and the remaining blog node migration doesn't run (but if I run it manually by itself, it works, though one node out of 77 references wrong media).

πŸ’¬ Support request
Status

Closed: cannot reproduce

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States seanr

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024