Config export fails with TypeError in SplitFilter

Created on 14 June 2022, about 2 years ago
Updated 17 May 2024, about 1 month ago

Problem/Motivation

The config export (drush cex) fails after we updated Drupal to 9.3.16.
We are running Drush 10.6.2, Config Split 8.x-1.8
With Drupal 9.3.12 it was working.
We have configured a split for development and production on the same project for a solr server host.

Error messages:
[error] TypeError: array_keys(): Argument #1 ($array) must be of type array, null given in array_keys() (line 342 of /opt/drupal/web/modules/contrib/config_split/src/Plugin/ConfigFilter/SplitFilter.php) #0 /opt/drupal/web/modules/contrib/config_split/src/Plugin/ConfigFilter/SplitFilter.php(342): array_keys(NULL)
#1 /opt/drupal/web/modules/contrib/config_split/src/Plugin/ConfigFilter/SplitFilter.php(110): Drupal\config_split\Plugin\ConfigFilter\SplitFilter->calculateBlacklist()
#2 /opt/drupal/web/modules/contrib/config_split/src/Plugin/ConfigFilter/SplitFilter.php(253): Drupal\config_split\Plugin\ConfigFilter\SplitFilter->getBlacklist()
#3 /opt/drupal/web/modules/contrib/config_filter/src/Config/FilteredStorage.php(128): Drupal\config_split\Plugin\ConfigFilter\SplitFilter->filterDelete('block.block.vie...', true)
#4 /opt/drupal/web/modules/contrib/config_filter/src/Config/FilteredStorage.php(200): Drupal\config_filter\Config\FilteredStorage->delete('block.block.vie...')
#5 /opt/drupal/vendor/drush/drush/src/Drupal/Commands/config/ConfigExportCommands.php(165): Drupal\config_filter\Config\FilteredStorage->deleteAll()
#6 /opt/drupal/vendor/drush/drush/src/Drupal/Commands/config/ConfigExportCommands.php(117): Drush\Drupal\Commands\config\ConfigExportCommands->doExport(Array, '../config/sync')
#7 [internal function]: Drush\Drupal\Commands\config\ConfigExportCommands->export(NULL, Array)
#8 /opt/drupal/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#9 /opt/drupal/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#10 /opt/drupal/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#11 /opt/drupal/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(350): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#12 /opt/drupal/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /opt/drupal/vendor/symfony/console/Application.php(1027): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /opt/drupal/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand),
Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /opt/drupal/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /opt/drupal/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /opt/drupal/vendor/drush/drush/src/Runtime/Runtime.php(48): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /opt/drupal/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)
#19 /opt/drupal/vendor/drush/drush/drush(4): require('/opt/drupal/ven...')
#20 /opt/drupal/vendor/bin/drush(120): include('/opt/drupal/ven...')
#21 {main}.

Steps to reproduce

updateing Drupal to 9.3.16 and Config Split to 8.x-1.8 and do a drush cex

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇩🇪Germany olkoeller Hessen

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.

  • 🇫🇮Finland HeikkiY Oulu

    I encountered the same issue while updating from Config split 1.x to 2.x. The problem in my case was that during the upgrade process I had mixed up 1.x and 2.x configuration files for the splits when switching development branches.

    Basically in my config_split.config_split.environment.yml file I still had the old blacklist and graylist keys instead of the keys that 2.x is using. Config export was expecting to find an array but because the key was missing, it gave the error.

    The error was fixed by adding the correct keys to the config split configuration file:

    complete_list: {  }
    partial_list: { }
    
Production build 0.69.0 2024