Configuration import fails: Undefined array key "moderation_state" BaseFieldOverride

Created on 21 May 2024, 8 months ago

Problem/Motivation

I'm trying to import my configuration into a new project.

When I try to import the configuration via "drush cim" I get the following error. Then the import cannot be completed.
Any idea ,please.. Thanks

[warning] Undefined array key "moderation_state" BaseFieldOverride.php:180
 [error]  Error: Call to a member function getFieldStorageDefinition() on null in Drupal\Core\Field\Entity\BaseFieldOverride->getFieldStorageDefinition() (line 120 of /var/www/html/mysite/web/core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php) #0 /var/www/html/mysite/web/core/lib/Drupal/Core/Field/FieldConfigBase.php(373): Drupal\Core\Field\Entity\BaseFieldOverride->getFieldStorageDefinition()
#1 /var/www/html/mysite/web/core/lib/Drupal/Core/Field/FieldConfigBase.php(289): Drupal\Core\Field\FieldConfigBase->getSettings()
#2 /var/www/html/mysite/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(430): Drupal\Core\Field\FieldConfigBase->postCreate()
#3 /var/www/html/mysite/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(357): Drupal\Core\Config\Entity\ConfigEntityStorage->_doCreateFromStorageRecord()
#4 /var/www/html/mysite/web/core/lib/Drupal/Core/Config/ConfigImporter.php(1068): Drupal\Core\Config\Entity\ConfigEntityStorage->importCreate()
#5 /var/www/html/mysite/web/core/lib/Drupal/Core/Config/ConfigImporter.php(851): Drupal\Core\Config\ConfigImporter->importInvokeOwner()
#6 /var/www/html/mysite/web/core/lib/Drupal/Core/Config/ConfigImporter.php(672): Drupal\Core\Config\ConfigImporter->processConfiguration()
#7 /var/www/html/mysite/web/core/lib/Drupal/Core/Config/ConfigImporter.php(570): Drupal\Core\Config\ConfigImporter->processConfigurations()
#8 /var/www/html/mysite/vendor/drush/drush/src/Commands/config/ConfigImportCommands.php(259): Drupal\Core\Config\ConfigImporter->doSyncStep()
#9 /var/www/html/mysite/vendor/drush/drush/includes/drush.inc(62): Drush\Commands\config\ConfigImportCommands->doImport()
#10 /var/www/html/mysite/vendor/drush/drush/includes/drush.inc(53): drush_call_user_func_array()
#11 /var/www/html/mysite/vendor/drush/drush/src/Commands/config/ConfigImportCommands.php(230): drush_op()
#12 [internal function]: Drush\Commands\config\ConfigImportCommands->import()
#13 /var/www/html/mysite/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array()
#14 /var/www/html/mysite/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback()
#15 /var/www/html/mysite/vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter()
#16 /var/www/html/mysite/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(387): Consolidation\AnnotatedCommand\CommandProcessor->process()
#17 /var/www/html/mysite/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()
#18 /var/www/html/mysite/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run()
#19 /var/www/html/mysite/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand()
#20 /var/www/html/mysite/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun()
#21 /var/www/html/mysite/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run()
#22 /var/www/html/mysite/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun()
#23 /var/www/html/mysite/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run()
#24 /var/www/html/mysite/vendor/drush/drush/drush(4): require('...')
#25 /var/www/html/mysite/vendor/bin/drush(119): include('...')
#26 {main}. 
Error: Call to a member function getFieldStorageDefinition() on null in /var/www/html/mysite/web/core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php on line 120 #0 /var/www/html/mysite/web/core/lib/Drupal/Core/Field/FieldConfigBase.php(373): Drupal\Core\Field\Entity\BaseFieldOverride->getFieldStorageDefinition()
#1 /var/www/html/mysite/web/core/lib/Drupal/Core/Field/FieldConfigBase.php(289): Drupal\Core\Field\FieldConfigBase->getSettings()
#2 /var/www/html/mysite/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(430): Drupal\Core\Field\FieldConfigBase->postCreate()
#3 /var/www/html/mysite/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(357): Drupal\Core\Config\Entity\ConfigEntityStorage->_doCreateFromStorageRecord()
#4 /var/www/html/mysite/web/core/lib/Drupal/Core/Config/ConfigImporter.php(1068): Drupal\Core\Config\Entity\ConfigEntityStorage->importCreate()
#5 /var/www/html/mysite/web/core/lib/Drupal/Core/Config/ConfigImporter.php(851): Drupal\Core\Config\ConfigImporter->importInvokeOwner()
#6 /var/www/html/mysite/web/core/lib/Drupal/Core/Config/ConfigImporter.php(672): Drupal\Core\Config\ConfigImporter->processConfiguration()
#7 /var/www/html/mysite/web/core/lib/Drupal/Core/Config/ConfigImporter.php(570): Drupal\Core\Config\ConfigImporter->processConfigurations()
#8 /var/www/html/mysite/vendor/drush/drush/src/Commands/config/ConfigImportCommands.php(259): Drupal\Core\Config\ConfigImporter->doSyncStep()
#9 /var/www/html/mysite/vendor/drush/drush/includes/drush.inc(62): Drush\Commands\config\ConfigImportCommands->doImport()
#10 /var/www/html/mysite/vendor/drush/drush/includes/drush.inc(53): drush_call_user_func_array()
#11 /var/www/html/mysite/vendor/drush/drush/src/Commands/config/ConfigImportCommands.php(230): drush_op()
#12 [internal function]: Drush\Commands\config\ConfigImportCommands->import()
#13 /var/www/html/mysite/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array()
#14 /var/www/html/mysite/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback()
#15 /var/www/html/mysite/vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter()
#16 /var/www/html/mysite/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(387): Consolidation\AnnotatedCommand\CommandProcessor->process()
#17 /var/www/html/mysite/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()
#18 /var/www/html/mysite/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run()
#19 /var/www/html/mysite/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand()
#20 /var/www/html/mysite/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun()
#21 /var/www/html/mysite/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run()
#22 /var/www/html/mysite/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun()
#23 /var/www/html/mysite/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run()
#24 /var/www/html/mysite/vendor/drush/drush/drush(4): require('...')
#25 /var/www/html/mysite/vendor/bin/drush(119): include('...')
#26 {main}
Error: Call to a member function getFieldStorageDefinition() on null in Drupal\Core\Field\Entity\BaseFieldOverride->getFieldStorageDefinition() (line 120 of /var/www/html/mysite/web/core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php).
 [warning] Drush command terminated abnormally.
💬 Support request
Status

Active

Version

10.3

Component
Content moderation 

Last updated about 24 hours ago

Created by

🇬🇧United Kingdom jaydenpearly

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

Comments & Activities

  • Issue created by @jaydenpearly
  • 🇮🇳India ashetkar

    Please try patch mentioned in below thread @jaydenpearly
    https://www.drupal.org/project/drupal/issues/2321071 🐛 BaseFieldOverride fails to take into account ContentEntityInterface::bundleFieldDefinitions() when invoking onFieldDefinitionUpdate() Needs work .

  • 🇬🇧United Kingdom jaydenpearly

    Hi @ashetkar,
    Thanks for reply but it didn't worked for me.
    I found another way, which I don't know if it's really a solution.
    My project is multilingual.
    Once you empty the entire translation folder (all en-es-fr po files), the "Undefined array key moderation_state..." warning disappears and the configuration import is completed. I don't know what it has to do with this warning.

  • I have the same issue with Drupal 10.3.0 (and 10.2.x).

    My website is also a multilanguage one and "drush cim" fail on content moderation field import.

    The last patch in the proposed thread generates a different error. In the thread they mention that the moderation state field is not a translatable one and this is probabably the cause of the error.

  • 🇧🇪Belgium dtfabio Ninove

    I had the same problem with my Drupal 10.2.0 site after I wanted to re-import from a DB snapshot in ddev.

    I started from a snapshot just before adding the translations and it kept failing to import the config.

    The solution from the ticket linked here by n.dhuygelaere also solved my problem.

  • Status changed to Closed: duplicate 3 months ago
  • 🇩🇪Germany geek-merlin Freiburg, Germany
Production build 0.71.5 2024