Problem/Motivation

If we use Domain Access module we receive the following error:

An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /en/batch?id=993&op=do_nojs&op=do
StatusText: Internal Server Error
ResponseText: The website encountered an unexpected error. Please try again later.Drupal\Core\Entity\EntityStorageException: 'field_config' entity with ID 'node.consultation.field_domain_access' already exists. in Drupal\Core\Entity\EntityStorageBase->doPreSave() (line 490 of core/lib/Drupal/Core/Entity/EntityStorageBase.php). Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 263)
Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object) (Line: 398)
Drupal\Core\Entity\EntityBase->save() (Line: 613)
Drupal\Core\Config\Entity\ConfigEntityBase->save() (Line: 41)
Drupal\entity_type_clone\Form\CloneEntityTypeData::cloneEntityTypeField(Array, Array) (Line: 295)
_batch_process() (Line: 137)
_batch_do() (Line: 93)
_batch_page(Object) (Line: 55)
Drupal\system\Controller\BatchController->batchPage(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 115)
Drupal\shield\ShieldMiddleware->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

Add and enable the Domain Access module, setup its using, add filed into a CT which will be cloned after that.

Proposed resolution

Research and find our where is the problem and why the module wants to clone a domain access field twice.

Comments

vuil created an issue. See original summary.

jolalla’s picture

I have a similar error:
Drupal\Core\Entity\EntityStorageException: 'field_config' entity with ID 'node.alerta44.field_domain_access' already exists. en Drupal\Core\Entity\EntityStorageBase->doPreSave() (linea 490 de /core/lib/Drupal/Core/Entity/EntityStorageBase.php).

vuil’s picture

nbaosullivan’s picture

Current work around is to temporarily manually delete field_domain_access and field_domain_all_affiliates from source entity type, then re-add after you have cloned. The domain fields will automatically be added to your newly cloned entities. If like me you had many fields and a form display set up, this is worth it! Thanks for the module!

vuil’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev
vuil’s picture

Version: 8.x-2.x-dev » 4.0.x-dev
dmezquia’s picture

vuil’s picture

Status: Active » Fixed

Resolved in the latest stable release.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.