Not possible to create more than 1 node at a time on Inline entity form - Complex

Created on 21 May 2025, 12 days ago

Problem/Motivation

In the complex Inline Entity Form we are unable to add the second node to a referenced entity.
When we press the Add node for the second referenced node the form appears filled with the previous node data,

we edit the fields and press create node, it appears successful,

but when we save the main node we get the error "The website encountered an unexpected error. Try again later."
on the logs we have two messages

node:
Drupal\Core\Database\IntegrityConstraintViolationException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'efbf24bc-2e06-4f8d-90eb-b36fccc24358' for key 'node_field__uuid__value': INSERT INTO "node" ("vid", "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] => evidences [:db_insert_placeholder_2] => efbf24bc-2e06-4f8d-90eb-b36fccc24358 [:db_insert_placeholder_3] => en ) in Drupal\mysql\Driver\Database\mysql\ExceptionHandler->handleExecutionException() (line 45 of /home/humaniz3/ni.hs.com/web/core/modules/mysql/src/Driver/Database/mysql/ExceptionHandler.php).

Backtrace
#0 /home/humaniz3/ni.hs.com/web/core/modules/mysql/src/Driver/Database/mysql/Insert.php(38): Drupal\mysql\Driver\Database\mysql\ExceptionHandler->handleExecutionException()
#1 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(945): Drupal\mysql\Driver\Database\mysql\Insert->execute()
#2 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(718): Drupal\Core\Entity\Sql\SqlContentEntityStorage->doSaveFieldItems()
#3 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(486): Drupal\Core\Entity\ContentEntityStorageBase->doSave()
#4 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(805): Drupal\Core\Entity\EntityStorageBase->save()
#5 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/Entity/EntityBase.php(354): Drupal\Core\Entity\Sql\SqlContentEntityStorage->save()
#6 /home/humaniz3/ni.hs.com/web/modules/contrib/inline_entity_form/src/Form/EntityInlineForm.php(298): Drupal\Core\Entity\EntityBase->save()
#7 /home/humaniz3/ni.hs.com/web/modules/contrib/inline_entity_form/src/WidgetSubmit.php(57): Drupal\inline_entity_form\Form\EntityInlineForm->save()
#8 [internal function]: Drupal\inline_entity_form\WidgetSubmit::doSubmit()
#9 /home/humaniz3/ni.hs.com/web/modules/contrib/inline_entity_form/src/ElementSubmit.php(109): call_user_func_array()
#10 /home/humaniz3/ni.hs.com/web/modules/contrib/inline_entity_form/src/ElementSubmit.php(79): Drupal\inline_entity_form\ElementSubmit::doSubmit()
#11 [internal function]: Drupal\inline_entity_form\ElementSubmit::trigger()
#12 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/Form/FormSubmitter.php(105): call_user_func_array()
#13 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/Form/FormSubmitter.php(43): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers()
#14 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/Form/FormBuilder.php(589): Drupal\Core\Form\FormSubmitter->doSubmitForm()
#15 /home/humaniz3/ni.hs.com/web/modules/contrib/autosave_form/src/Form/AutosaveFormBuilder.php(144): Drupal\Core\Form\FormBuilder->processForm()
#16 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/Form/FormBuilder.php(321): Drupal\autosave_form\Form\AutosaveFormBuilder->processForm()
#17 /home/humaniz3/ni.hs.com/web/modules/contrib/autosave_form/src/Form/AutosaveFormBuilder.php(97): Drupal\Core\Form\FormBuilder->buildForm()
#18 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\autosave_form\Form\AutosaveFormBuilder->buildForm()
#19 /home/humaniz3/ni.hs.com/web/core/modules/layout_builder/src/Controller/LayoutBuilderHtmlEntityFormController.php(39): Drupal\Core\Controller\FormController->getContentResult()
#20 [internal function]: Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult()
#21 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#22 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/Render/Renderer.php(593): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#23 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext()
#24 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#25 /home/humaniz3/ni.hs.com/vendor/symfony/http-kernel/HttpKernel.php(183): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#26 /home/humaniz3/ni.hs.com/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#27 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#28 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#29 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#30 /home/humaniz3/ni.hs.com/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
#31 /home/humaniz3/ni.hs.com/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(116): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#32 /home/humaniz3/ni.hs.com/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(90): Drupal\page_cache\StackMiddleware\PageCache->pass()
#33 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#34 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#35 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#36 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#37 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/DrupalKernel.php(709): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#38 /home/humaniz3/ni.hs.com/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#39 {main}

php:
Drupal\Core\Entity\EntityStorageException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'efbf24bc-2e06-4f8d-90eb-b36fccc24358' for key 'node_field__uuid__value': INSERT INTO "node" ("vid", "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] => evidences [:db_insert_placeholder_2] => efbf24bc-2e06-4f8d-90eb-b36fccc24358 [:db_insert_placeholder_3] => en ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 816 of /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Backtrace
#0 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/Entity/EntityBase.php(354): Drupal\Core\Entity\Sql\SqlContentEntityStorage->save()
#1 /home/humaniz3/ni.hs.com/web/modules/contrib/inline_entity_form/src/Form/EntityInlineForm.php(298): Drupal\Core\Entity\EntityBase->save()
#2 /home/humaniz3/ni.hs.com/web/modules/contrib/inline_entity_form/src/WidgetSubmit.php(57): Drupal\inline_entity_form\Form\EntityInlineForm->save()
#3 [internal function]: Drupal\inline_entity_form\WidgetSubmit::doSubmit()
#4 /home/humaniz3/ni.hs.com/web/modules/contrib/inline_entity_form/src/ElementSubmit.php(109): call_user_func_array()
#5 /home/humaniz3/ni.hs.com/web/modules/contrib/inline_entity_form/src/ElementSubmit.php(79): Drupal\inline_entity_form\ElementSubmit::doSubmit()
#6 [internal function]: Drupal\inline_entity_form\ElementSubmit::trigger()
#7 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/Form/FormSubmitter.php(105): call_user_func_array()
#8 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/Form/FormSubmitter.php(43): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers()
#9 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/Form/FormBuilder.php(589): Drupal\Core\Form\FormSubmitter->doSubmitForm()
#10 /home/humaniz3/ni.hs.com/web/modules/contrib/autosave_form/src/Form/AutosaveFormBuilder.php(144): Drupal\Core\Form\FormBuilder->processForm()
#11 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/Form/FormBuilder.php(321): Drupal\autosave_form\Form\AutosaveFormBuilder->processForm()
#12 /home/humaniz3/ni.hs.com/web/modules/contrib/autosave_form/src/Form/AutosaveFormBuilder.php(97): Drupal\Core\Form\FormBuilder->buildForm()
#13 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\autosave_form\Form\AutosaveFormBuilder->buildForm()
#14 /home/humaniz3/ni.hs.com/web/core/modules/layout_builder/src/Controller/LayoutBuilderHtmlEntityFormController.php(39): Drupal\Core\Controller\FormController->getContentResult()
#15 [internal function]: Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult()
#16 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#17 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/Render/Renderer.php(593): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#18 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext()
#19 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#20 /home/humaniz3/ni.hs.com/vendor/symfony/http-kernel/HttpKernel.php(183): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#21 /home/humaniz3/ni.hs.com/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#22 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#23 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#24 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#25 /home/humaniz3/ni.hs.com/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
#26 /home/humaniz3/ni.hs.com/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(116): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#27 /home/humaniz3/ni.hs.com/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(90): Drupal\page_cache\StackMiddleware\PageCache->pass()
#28 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#29 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#30 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#31 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#32 /home/humaniz3/ni.hs.com/web/core/lib/Drupal/Core/DrupalKernel.php(709): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#33 /home/humaniz3/ni.hs.com/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#34 {main}

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

3.0

Component

User interface

Created by

🇵🇹Portugal jgraca

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

Comments & Activities

Production build 0.71.5 2024