I enabled the language module on my site, and then went to go update the sitemap to the default language.
The website encountered an unexpected error. Please try again later.</br></br><em class="placeholder">Drupal\Core\Config\ConfigDuplicateUUIDException</em>: Attempt to save a configuration entity 'g3XYqcXbSKPVBDODwnT6pq7oqhCFkPryj4vVqrl_Kfc' with UUID '1af1b0e9-db49-453d-a439-918683b1402b' when this UUID is already used for 'NXhscRe0440PFpI5dSznEVgmauL25KojD7u4e9aZwOM' in <em class="placeholder">Drupal\Core\Config\Entity\ConfigEntityBase->preSave()</em> (line <em class="placeholder">326</em> of <em class="placeholder">core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php</em>). <pre class="backtrace">Drupal\Core\Entity\EntityStorageBase->doPreSave(Object) (Line: 426)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 263)
Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object) (Line: 390)
Drupal\Core\Entity\Entity->save() (Line: 632)
Drupal\Core\Config\Entity\ConfigEntityBase->save() (Line: 75)
Drupal\xmlsitemap\Form\XmlSitemapForm->save(Array, Object)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 589)
Drupal\Core\Form\FormBuilder->processForm('xmlsitemap_sitemap_edit_form', Array, Object) (Line: 318)
Drupal\Core\Form\FormBuilder->buildForm('xmlsitemap_sitemap_edit_form', Object) (Line: 93)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
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: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->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: 665)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
</pre>
Comments
Comment #2
dave reidI think the solution is to make the config ID a machine name, and have the context hash be a separate property on the config entity. That way we can freely change it when needed.
Comment #3
KittenDestroyer commentedAdding a patch for that. Please review as it will probably need improvement.
Comment #4
KittenDestroyer commentedComment #5
KittenDestroyer commentedAdded missing exists method. Added context id to list builder and check on save.
Comment #6
KittenDestroyer commentedUpdated list builder test and fixed fails on my side.
Comment #7
niko- commentedupdated patch for latest d9
Comment #8
niko- commentedReroll last patch
Comment #10
xurizaemonSome sites affected by this issue may already have a config state which requires resolution here.
A common configuration appears to be:
[](hashNXhscRe0440PFpI5dSznEVgmauL25KojD7u4e9aZwOM)['language' => 'en'](hashg3XYqcXbSKPVBDODwnT6pq7oqhCFkPryj4vVqrl_Kfc).If the patch here is then applied, the update process to try and resolve this state fails when two entries are resolved to a single machine name, and the DB update fails when trying to write the second one.
> [notice] Update started: xmlsitemap_update_8004 > [error] SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'xmlsitemap.xmlsitemap.sector_default_sitemap' for key 'config.PRIMARY': UPDATE "config" SET "name"=:db_update_placeholder_0 > WHERE ("name" = :db_condition_placeholder_0) AND ("collection" = :db_condition_placeholder_1); Array > ( > [:db_update_placeholder_0] => xmlsitemap.xmlsitemap.sector_default_sitemap > [:db_condition_placeholder_0] => xmlsitemap.xmlsitemap.NXhscRe0440PFpI5dSznEVgmauL25KojD7u4e9aZwOM > [:db_condition_placeholder_1] => > ) > > [error] Update failed: xmlsitemap_update_8004 [error] Update aborted by: xmlsitemap_update_8004 [error] Finished performing updates.("Sector default sitemap" is the default name from Sector profile, and it installs with language module disabled and hash NXhscRe0440PFpI5dSznEVgmauL25KojD7u4e9aZwOM.)
Comment #11
xurizaemonAh, it seems that issue is because sites which install from existing configuration don't have
xmlsitemap_update_8004()applied, which makes sense.