Crashes on leftovover themeconfig

Created on 12 May 2023, about 1 year ago
Updated 31 July 2023, 11 months ago

Problem/Motivation

Sometheme has been (incompletely) removed. Then config_inspector installed. Upon going to configure config_inspector crashes.

The website encountered an unexpected error. Please try again later.

InvalidArgumentException: The configuration property conditions.current_theme.theme.somethemename doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get() (line 76 of core/lib/Drupal/Core/Config/Schema/ArrayElement.php).

Drupal\config_inspector\ConfigInspectorManager->checkValue() (Line: 137)
Drupal\config_inspector\ConfigInspectorManager->checkValue() (Line: 137)
Drupal\config_inspector\ConfigInspectorManager->checkValue() (Line: 137)
Drupal\config_inspector\ConfigInspectorManager->checkValue() (Line: 61)
Drupal\config_inspector\ConfigInspectorManager->checkConfigSchema() (Line: 137)
Drupal\config_inspector\ConfigInspectorManager->checkValues() (Line: 170)
Drupal\config_inspector\Controller\ConfigInspectorController->overview()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 23)
Stack\StackedHttpKernel->handle() (Line: 718)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Steps to reproduce

Proposed resolution

Report error in configuration.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs work

Version

2.1

Component

Code

Created by

πŸ‡¦πŸ‡ΉAustria maxilein

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

Comments & Activities

  • Issue created by @maxilein
  • πŸ‡¦πŸ‡ΉAustria maxilein

    maybe this helps https://www.drupal.org/project/drupal/issues/2925890 πŸ› Invalid config structures can result in exceptions when saving a config entity Needs work

  • Status changed to Postponed: needs info about 1 year ago
  • πŸ‡­πŸ‡ΊHungary GΓ‘bor Hojtsy Hungary

    I think πŸ“Œ Config inspection should wipe relevant caches to always get up-to-date results Fixed should have helped for this? Can you check?

  • πŸ‡¦πŸ‡ΉAustria maxilein

    Thanky you. I tested the new release. I get the same error. And in the meantime I suspect it is a wrong config.

    My question is: since config inspector is a tool to find problems in the config, shouldn't it be able to continue on such an error and list the invalid entry instead of crashing?

  • Status changed to Needs work about 1 year ago
  • πŸ‡­πŸ‡ΊHungary GΓ‘bor Hojtsy Hungary

    It should definitely not crash on invalid config indeed. The exception comes from ArrayElement::get() in Drupal core.

      /**
       * {@inheritdoc}
       */
      public function get($name) {
        $parts = explode('.', $name);
        $root_key = array_shift($parts);
        $elements = $this
          ->getElements();
        if (isset($elements[$root_key])) {
          $element = $elements[$root_key];
    
          // If $property_name contained a dot recurse into the keys.
          while ($element && ($key = array_shift($parts)) !== NULL) {
            if ($element instanceof TypedConfigInterface) {
              $element = $element
                ->get($key);
            }
            else {
              $element = NULL;
            }
          }
        }
        if (isset($element)) {
          return $element;
        }
        else {
          throw new \InvalidArgumentException("The configuration property {$name} doesn't exist.");
        }
      }
    

    checkValues() does not document as even re-throwing an InvalidArgumentException but it is documented to rethrow SchemaIncompleteException, which it should also convert into an error to display rather than throw.

  • πŸ‡¦πŸ‡ΉAustria maxilein

    I don't understand where the value is expected. Where should the property exist? In the config table? In the theme yml?
    Maybe I can help more by getting more information.

  • πŸ‡ͺπŸ‡ΈSpain aleix

    While it doesn't solve what GΓ‘bor said: @maxilein this configuration comes from asset_injector module, following steps as https://www.drupal.org/project/asset_injector/issues/3329577#comment-150... πŸ› Fatal error: Schema error for theme condition selection field Fixed helps .

  • πŸ‡¦πŸ‡ΉAustria maxilein

    Aleix, thank you. That makes sense! I will investigate and report here.

  • πŸ‡¦πŸ‡ΉAustria maxilein

    Well I am already using the latest versions of asset injector.

    What i can report about the situation: there was an old theme installed and used as default. The designer completely reworked his theme to a new version but kept the old theme name. Since there was no upgrade path the new one was copied over the old one...

    So there may be some left over configs. I will try and re-save all assets and see if that makes a difference.

  • πŸ‡¦πŸ‡ΉAustria maxilein

    So saved all asset injectors. There are still 2 Errors:

    Error message
    
        Warning: Undefined array key "compare_format" in Drupal\name\Plugin\diff\Field\NameFieldBuilder->build() (line 73 of modules/contrib/name/src/Plugin/diff/Field/NameFieldBuilder.php).
    
        Drupal\name\Plugin\diff\Field\NameFieldBuilder->build(Object) (Line: 94)
        Drupal\diff\DiffEntityParser->parseEntity(Object) (Line: 104)
        Drupal\diff\DiffEntityComparison->compareRevisions(Object, Object) (Line: 181)
        Drupal\elogger\Services\Elogger->entityDiff(Object) (Line: 472)
        Drupal\elogger\Services\Elogger->prepareEntityLogMessage('entity_update', Object) (Line: 532)
        Drupal\elogger\Services\Elogger->logEvent('entity_update') (Line: 73)
        _log_entity_event('entity_update', Object) (Line: 50)
        elogger_entity_update(Object)
        call_user_func_array(Object, Array) (Line: 426)
        Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'elogger') (Line: 405)
        Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_update', Object) (Line: 433)
        Drupal\Core\Extension\ModuleHandler->invokeAll('entity_update', Array) (Line: 251)
        Drupal\Core\Entity\EntityStorageBase->invokeHook('update', Object) (Line: 900)
        Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('update', Object) (Line: 598)
        Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, 1) (Line: 781)
        Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object, 1) (Line: 523)
        Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 804)
        Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 339)
        Drupal\Core\Entity\EntityBase->save() (Line: 46)
        Drupal\user\ProfileForm->save(Array, Object)
        call_user_func_array(Array, Array) (Line: 114)
        Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
        Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 597)
        Drupal\Core\Form\FormBuilder->processForm('user_form', Array, Object) (Line: 325)
        Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
        Drupal\Core\Controller\FormController->getContentResult(Object, Object) (Line: 39)
        Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult(Object, Object)
        call_user_func_array(Array, Array) (Line: 123)
        Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
        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: 169)
        Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
        Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
        Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
        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: 48)
        Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
        Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
        Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
        Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
    
        Warning: Undefined array key "compare_format" in Drupal\name\Plugin\diff\Field\NameFieldBuilder->build() (line 73 of modules/contrib/name/src/Plugin/diff/Field/NameFieldBuilder.php).
    
        Drupal\name\Plugin\diff\Field\NameFieldBuilder->build(Object) (Line: 94)
        Drupal\diff\DiffEntityParser->parseEntity(Object) (Line: 105)
        Drupal\diff\DiffEntityComparison->compareRevisions(Object, Object) (Line: 181)
        Drupal\elogger\Services\Elogger->entityDiff(Object) (Line: 472)
        Drupal\elogger\Services\Elogger->prepareEntityLogMessage('entity_update', Object) (Line: 532)
        Drupal\elogger\Services\Elogger->logEvent('entity_update') (Line: 73)
        _log_entity_event('entity_update', Object) (Line: 50)
        elogger_entity_update(Object)
        call_user_func_array(Object, Array) (Line: 426)
        Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'elogger') (Line: 405)
        Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_update', Object) (Line: 433)
        Drupal\Core\Extension\ModuleHandler->invokeAll('entity_update', Array) (Line: 251)
        Drupal\Core\Entity\EntityStorageBase->invokeHook('update', Object) (Line: 900)
        Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('update', Object) (Line: 598)
        Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, 1) (Line: 781)
        Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object, 1) (Line: 523)
        Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 804)
        Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 339)
        Drupal\Core\Entity\EntityBase->save() (Line: 46)
        Drupal\user\ProfileForm->save(Array, Object)
        call_user_func_array(Array, Array) (Line: 114)
        Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
        Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 597)
        Drupal\Core\Form\FormBuilder->processForm('user_form', Array, Object) (Line: 325)
        Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
        Drupal\Core\Controller\FormController->getContentResult(Object, Object) (Line: 39)
        Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult(Object, Object)
        call_user_func_array(Array, Array) (Line: 123)
        Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
        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: 169)
        Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
        Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
        Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
        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: 48)
        Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
        Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
        Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
        Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
    
    
  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    Is there an open issue to catch that in core and return an unknown error?

  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    Found πŸ› Invalid config structures can result in exceptions when saving a config entity Needs work but that seems like its not addressing the issue in the schema check trait, which I would have expected

    I'll open a new issue

  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    Ah! the issue is we had the patch (comment 29) from the above issue applied

Production build 0.69.0 2024