Config import fails with non existent theme reporting TypeError: array_diff():

Created on 19 October 2022, almost 2 years ago
Updated 12 September 2023, 12 months ago

Problem/Motivation

Import of single config of views.view.[viewname] fails dblog reports:

TypeError: array_diff(): Argument #1 ($array) must be of type array, null given in array_diff() (line 312 of /code/web/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php) 

#0 /code/web/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php(312): array_diff(NULL, Array)
#1 /code/web/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php(96): Drupal\Core\EventSubscriber\ConfigImportSubscriber->validateDependencies(Object(Drupal\Core\Config\ConfigImporter))
#2 [internal function]: Drupal\Core\EventSubscriber\ConfigImportSubscriber->onConfigImporterValidate(Object(Drupal\Core\Config\ConfigImporterEvent), 'config.importer...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#3 /code/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func(Array, Object(Drupal\Core\Config\ConfigImporterEvent), 'config.importer...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#4 /code/web/core/lib/Drupal/Core/Config/ConfigImporter.php(756): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Drupal\Core\Config\ConfigImporterEvent), 'config.importer...')
#5 /code/web/core/modules/config/src/Form/ConfigSingleImportForm.php(377): Drupal\Core\Config\ConfigImporter->validate()
#6 [internal function]: Drupal\config\Form\ConfigSingleImportForm->validateForm(Array, Object(Drupal\Core\Form\FormState))
#7 /code/web/core/lib/Drupal/Core/Form/FormValidator.php(82): call_user_func_array(Array, Array)
#8 /code/web/core/lib/Drupal/Core/Form/FormValidator.php(275): Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object(Drupal\Core\Form\FormState))
#9 /code/web/core/lib/Drupal/Core/Form/FormValidator.php(118): Drupal\Core\Form\FormValidator->doValidateForm(Array, Object(Drupal\Core\Form\FormState), 'config_single_i...')
#10 /code/web/core/lib/Drupal/Core/Form/FormBuilder.php(588): Drupal\Core\Form\FormValidator->validateForm('config_single_i...', Array, Object(Drupal\Core\Form\FormState))
#11 /code/web/core/lib/Drupal/Core/Form/FormBuilder.php(320): Drupal\Core\Form\FormBuilder->processForm('config_single_i...', Array, Object(Drupal\Core\Form\FormState))
#12 /code/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\config\Form\ConfigSingleImportForm), Object(Drupal\Core\Form\FormState))
#13 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
#14 /code/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#15 /code/web/core/lib/Drupal/Core/Render/Renderer.php(564): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#16 /code/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#17 /code/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#18 /code/vendor/symfony/http-kernel/HttpKernel.php(159): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#19 /code/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#20 /code/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 /code/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 /code/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 /code/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 /code/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 /code/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 /code/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 /code/web/core/lib/Drupal/Core/DrupalKernel.php(709): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 /code/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#29 {main}

.

Steps to reproduce

Multiple attempts before and after applying all available updates for Core version 9.4.8
Export single config for views.view.[viewname].yml from UI /admin/config/development/configuration/single/export
Import from UI /admin/config/development/configuration/single/import

Proposed resolution

Better error messaging would be very helpful to identify what actually failed.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Needs work

Version

9.5

Component
Configuration 

Last updated 1 day ago

Created by

🇺🇸United States bsnodgrass

Live updates comments and jobs are added and updated live.
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.

  • 🇺🇸United States bsnodgrass

    @ https://www.drupal.org/u/jakegibs617 https://www.drupal.org/project/drupal/issues/3316271#comment-14878863 🐛 Config import fails with non existent theme reporting TypeError: array_diff(): Needs work appears to be the same error, but occurring on a different line.

    https://www.drupal.org/project/drupal/issues/3316271#comment-14878863 🐛 Config import fails with non existent theme reporting TypeError: array_diff(): Needs work is a different issue.

    The error is ambiguous and is difficult to track down. If I recall we looked at the code to determine what was actually failing and noticed old artifacts in config left over from our migration work moving from Drupal 6 to Drupal 8.

  • Status changed to Needs review over 1 year ago
  • 🇮🇳India Ranjit1032002

    Created a patch for the issue mentioned, please review.
    Thank You.

  • Status changed to Needs work over 1 year ago
  • 🇺🇸United States smustgrave

    #11 doesn't address the proposed solution "Better error messaging would be very helpful to identify what actually failed."

    Have imported views several times without issues, maybe it's a problem with the view?

    This will need test case though.

  • 🇨🇴Colombia alejo-moreno

    I'm getting a similar error when deploying to Acquia to one of the Dev databases. This is likely to happen in Prod in the next deploy but the detail of the error is not enough to spot the issue, which one could be the configuration failing? Even more weird that this just happens in Acquia and not in the local machine with the same database and code.

    |            | purge_queuer_coretags.settings       | Delete    |
    |            | purge.logger_channels                | Delete    |
    |            | new_relic_rpm.settings               | Delete    |
    +------------+--------------------------------------+-----------+
     [warning] Undefined array key "theme" ConfigImporter.php:456
     [error]  TypeError: array_diff_key(): Argument #1 ($array) must be of type array, null given in array_diff_key() (line 456 of /mnt/www/html/project_ucod/docroot/core/lib/Drupal/Core/Config/ConfigImporter.php) #0 /mnt/www/html/project_ucod/docroot/core/lib/Drupal/Core/Config/ConfigImporter.php(456): array_diff_key()
    #1 /mnt/www/html/project_ucod/docroot/core/lib/Drupal/Core/Config/ConfigImporter.php(777): Drupal\Core\Config\ConfigImporter->createExtensionChangelist()
    #2 /mnt/www/html/project_ucod/docroot/core/lib/Drupal/Core/Config/ConfigImporter.php(566): Drupal\Core\Config\ConfigImporter->validate()
    #3 /mnt/www/html/project_ucod/vendor/drush/drush/src/Drupal/Commands/config/ConfigImportCommands.php(296): Drupal\Core\Config\ConfigImporter->initialize()
    #4 [internal function]: Drush\Drupal\Commands\config\ConfigImportCommands->doImport()
    #5 /mnt/www/html/project_ucod/vendor/drush/drush/includes/drush.inc(122): call_user_func_array()
    #6 /mnt/www/html/project_ucod/vendor/drush/drush/includes/drush.inc(113): drush_call_user_func_array()
    #7 /mnt/www/html/project_ucod/vendor/drush/drush/src/Drupal/Commands/config/ConfigImportCommands.php(271): drush_op()
    #8 [internal function]: Drush\Drupal\Commands\config\ConfigImportCommands->import()
    #9 /mnt/www/html/project_ucod/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array()
    #10 /mnt/www/html/project_ucod/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback()
    #11 /mnt/www/html/project_ucod/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter()
    #12 /mnt/www/html/project_ucod/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(391): Consolidation\AnnotatedCommand\CommandProcessor->process()
    #13 /mnt/www/html/project_ucod/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()
    #14 /mnt/www/html/project_ucod/vendor/symfony/console/Application.php(1039): Symfony\Component\Console\Command\Command->run()
    #15 /mnt/www/html/project_ucod/vendor/symfony/console/Application.php(275): Symfony\Component\Console\Application->doRunCommand()
    #16 /mnt/www/html/project_ucod/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
    #17 /mnt/www/html/project_ucod/vendor/drush/drush/src/Runtime/Runtime.php(124): Symfony\Component\Console\Application->run()
    #18 /mnt/www/html/project_ucod/vendor/drush/drush/src/Runtime/Runtime.php(51): Drush\Runtime\Runtime->doRun()
    #19 /mnt/www/html/project_ucod/vendor/drush/drush/drush.php(79): Drush\Runtime\Runtime->run()
    #20 /mnt/www/html/project_ucod/vendor/drush/drush/drush(4): require('...')
    #21 /mnt/www/html/project_ucod/vendor/bin/drush(119): include('...')
    
Production build 0.71.5 2024