Error: Attempt to assign property "moderation_state" on null in Drupal\content_moderation\Entity\ContentModerationState->save()

Created on 17 May 2024, 7 months ago

The following error occurs when running imports with content moderation enabled:

[error] Error: Attempt to assign property "moderation_state" on null in Drupal\content_moderation\Entity\ContentModerationState->save() (line 170 of /var/www/html/web/core/modules/content_moderation/src/Entity/ContentModerationState.php) #0 /var/www/html/web/modules/contrib/content_snapshot/src/ContentWriter/EntityContentWriter.php(52): Drupal\content_moderation\Entity\ContentModerationState->save()
#1 /var/www/html/web/modules/contrib/content_snapshot/src/ContentWriter/ContentWriterChain.php(32): Drupal\content_snapshot\ContentWriter\EntityContentWriter->write()
#2 /var/www/html/web/modules/contrib/content_snapshot/src/Importer/Importer.php(212): Drupal\content_snapshot\ContentWriter\ContentWriterChain->write()
#3 /var/www/html/web/modules/contrib/content_snapshot/src/Commands/Commands.php(122): Drupal\content_snapshot\Importer\Importer->import()
#4 [internal function]: Drupal\content_snapshot\Commands\Commands->import()
#5 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array()
#6 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback()
#7 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter()
#8 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(391): Consolidation\AnnotatedCommand\CommandProcessor->process()
#9 /var/www/html/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()
#10 /var/www/html/vendor/symfony/console/Application.php(1081): Symfony\Component\Console\Command\Command->run()
#11 /var/www/html/vendor/symfony/console/Application.php(320): Symfony\Component\Console\Application->doRunCommand()
#12 /var/www/html/vendor/symfony/console/Application.php(174): Symfony\Component\Console\Application->doRun()
#13 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run()
#14 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun()
#15 /var/www/html/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run()
#16 /var/www/html/vendor/drush/drush/drush(4): require('...')
#17 /var/www/html/vendor/bin/drush(119): include('...')
#18 {main}.
Error: Attempt to assign property "moderation_state" on null in /var/www/html/web/core/modules/content_moderation/src/Entity/ContentModerationState.php on line 170 #0 /var/www/html/web/modules/contrib/content_snapshot/src/ContentWriter/EntityContentWriter.php(52): Drupal\content_moderation\Entity\ContentModerationState->save()
#1 /var/www/html/web/modules/contrib/content_snapshot/src/ContentWriter/ContentWriterChain.php(32): Drupal\content_snapshot\ContentWriter\EntityContentWriter->write()
#2 /var/www/html/web/modules/contrib/content_snapshot/src/Importer/Importer.php(212): Drupal\content_snapshot\ContentWriter\ContentWriterChain->write()
#3 /var/www/html/web/modules/contrib/content_snapshot/src/Commands/Commands.php(122): Drupal\content_snapshot\Importer\Importer->import()
#4 [internal function]: Drupal\content_snapshot\Commands\Commands->import()
#5 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array()
#6 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback()
#7 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter()
#8 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(391): Consolidation\AnnotatedCommand\CommandProcessor->process()
#9 /var/www/html/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()
#10 /var/www/html/vendor/symfony/console/Application.php(1081): Symfony\Component\Console\Command\Command->run()
#11 /var/www/html/vendor/symfony/console/Application.php(320): Symfony\Component\Console\Application->doRunCommand()
#12 /var/www/html/vendor/symfony/console/Application.php(174): Symfony\Component\Console\Application->doRun()
#13 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run()
#14 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun()
#15 /var/www/html/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run()
#16 /var/www/html/vendor/drush/drush/drush(4): require('...')
#17 /var/www/html/vendor/bin/drush(119): include('...')
#18 {main}
Error: Attempt to assign property "moderation_state" on null in Drupal\content_moderation\Entity\ContentModerationState->save() (line 170 of /var/www/html/web/core/modules/content_moderation/src/Entity/ContentModerationState.php).

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

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

Comments & Activities

Production build 0.71.5 2024