Mysql Error when previewing and saving

Created on 30 July 2025, about 2 months ago

Problem/Motivation

When using the preview module incombination with taxonomy terms & paragraphs, there is a chance to get a hard - MYSQL error.

Drupal\Core\Entity\EntityStorageException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '2fd25df5-46f1-41e5-aa09-b043cc74478e' for key 'paragraphs_item.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] => body [:db_insert_placeholder_2] => 2fd25df5-46f1-41e5-aa09-b043cc74478e [:db_insert_placeholder_3] => nl ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 817 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php)

Steps to reproduce

  • Create a taxonomy bundle with paragraphs field
  • Enable preview mode
  • Create new term and click on preview
  • Go back to the term and click save.
  • Now the term is created but the values are still there (which shouldn't be)
  • Click save again

Proposed resolution

I wrote a patch that gets the UUID from the URL.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇳🇱Netherlands MarcKwee

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

Comments & Activities

Production build 0.71.5 2024