Config import creates "Undefined index: uuid" notice

Created on 24 March 2017, over 7 years ago
Updated 14 July 2024, about 2 months ago

In our use case we have two seach_api index sett-ups; one for local development and one for staging / produdction.

On deployment we use drush cset search_api.server.index status false to select the appropiate configuration.

This works fine for trash and rebuild on the local development machines, but when the configuration in imported on the persitent environments the following error is produced:

Notice: Undefined index: uuid in Drupal\Core\Config\StorageComparer->addChangelistUpdate() (line 262 of docroot/core/lib/Drupal/Core/Config/StorageComparer.php)
#0 docroot/core/includes/bootstrap.inc(548): _drupal_error_handler_real(8, 'Undefined index...', '/mnt/www/html/h...', 262, Array)
#1 docroot/core/lib/Drupal/Core/Config/StorageComparer.php(262): _drupal_error_handler(8, 'Undefined index...', '/mnt/www/html/h...', 262, Array)
#2 docroot/core/lib/Drupal/Core/Config/StorageComparer.php(206): Drupal\Core\Config\StorageComparer->addChangelistUpdate('')
#3 docroot/core/modules/config/src/Form/ConfigSync.php(181): Drupal\Core\Config\StorageComparer->createChangelist()
#4 [internal function]: Drupal\config\Form\ConfigSync->buildForm(Array, Object(Drupal\Core\Form\FormState))
#5 docroot/core/lib/Drupal/Core/Form/FormBuilder.php(514): call_user_func_array(Array, Array)
#6 docroot/core/lib/Drupal/Core/Form/FormBuilder.php(271): Drupal\Core\Form\FormBuilder->retrieveForm('config_admin_im...', Object(Drupal\Core\Form\FormState))
#7 docroot/core/lib/Drupal/Core/Controller/FormController.php(74): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\config\Form\ConfigSync), Object(Drupal\Core\Form\FormState))
#8 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
#9 docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#10 docroot/core/lib/Drupal/Core/Render/Renderer.php(574): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#11 docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#12 docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#13 [internal function]: Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#14 /mnt/www/html/hiscoxukstg/vendor/symfony/http-kernel/HttpKernel.php(144): call_user_func_array(Object(Closure), Array)
#15 /mnt/www/html/hiscoxukstg/vendor/symfony/http-kernel/HttpKernel.php(64): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #16 docroot/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 docroot/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#19 docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 docroot/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 docroot/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(50): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 /mnt/www/html/hiscoxukstg/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 docroot/core/lib/Drupal/Core/DrupalKernel.php(652): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 docroot/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#25 {main}.
🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Configuration 

Last updated 1 day ago

Created by

🇬🇧United Kingdom John Cook

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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.

  • 🇮🇳India Prashant.c Dharamshala

    We are also experiencing this issue on our site which was built on Drupal 8.6 and now upgraded to Drupal 10.0.8. Some of the configs like admin toolbar, advagg, etc.do not have UUIDs, I also doubt it is happening due to those.

    Changing to Major as it is a blocker during config export/import.

  • Status changed to Needs review 10 months ago
  • 🇺🇸United States neclimdul Houston, TX

    Webform also triggers this with its default contact form when installing from config.

    Don't think a notice qualifies for major. If someone could help me recreate the fatal from the load failures addressed in #4 maybe we can bump it back but I suspect that might be a different maybe related issue. Until then it will also be difficult to create a realistic test for it.

    Here's an updated patch for Drupal 10 with just the uuid handling (since I don't know how to recreate and test the load failure) and a test.

  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.1 & MariaDB 10.3.22
    last update 10 months ago
    30,482 pass
  • 🇺🇸United States neclimdul Houston, TX
    1. +++ b/core/tests/Drupal/Tests/Core/Config/StorageComparerTest.php
      @@ -284,6 +284,50 @@ public function testDifferentCollections() {
      +    $recreate_expected = [
      +      'field.storage.node.body',
      +      // TODO Should this be recreated?
      +      'views.view.test_view',
      +    ];
      

      This asserts the existing behavior with the undefined property evaluating to null. Is recreating actually correct though? That seems kinda odd.

    2. +++ b/core/tests/Drupal/Tests/Core/Config/StorageComparerTest.php
      @@ -284,6 +284,50 @@ public function testDifferentCollections() {
      +    // TODO does asserting the order matter here?
      +    $this->assertEqualsCanonicalizing($recreate_expected, $this->storageComparer->getChangelist('create'));
      +    $this->assertEqualsCanonicalizing($recreate_expected, $this->storageComparer->getChangelist('delete'));
      

      I don't know if the order matters here. Or if we need to assert it since its probably better tested else where. I would appreciate someone more familiar with the methods chiming in here.

  • Status changed to Needs work 10 months ago
  • The Needs Review Queue Bot tested this issue.

    While you are making the above changes, we recommend that you convert this patch to a merge request . Merge requests are preferred over patches. Be sure to hide the old patch files as well. (Converting an issue to a merge request without other contributions to the issue will not receive credit.)

  • 🇺🇦Ukraine teodorakis

    teodorakis changed the visibility of the branch 2863785-config-import-creates to hidden.

  • 🇺🇦Ukraine teodorakis

    teodorakis changed the visibility of the branch 2863785-config-import-creates to active.

  • 🇬🇧United Kingdom alexpott 🇪🇺🌍

    @neclimdul if webform is creating entities without a UUID then that's a bug in webform - no?

  • 🇬🇧United Kingdom therobyouknow

    I got this doing a drush cex

    A drush cr
    - clear cache

    appeared to resolve it

    My Drupal version 10.0.9 (need to upgrade to latest)

  • 🇬🇧United Kingdom therobyouknow

    this has come back

    when developing drupal code to share with others, I would want to remove the uuid
    https://drupal.stackexchange.com/questions/295320/best-practice-remove-u...

    however, I believe in doing so, it causes the "Undefined index: uuid". This post appears to explain: https://drupal.stackexchange.com/questions/204859/site-uuid-in-source-st...

Production build 0.71.5 2024