Problem/Motivation

Any time I run an update or cron, I get:

root@0968b6d03cdb:/var/www/html# drush cron
 [error]  Error: Call to undefined method Drupal\Core\Field\Plugin\Field\FieldType\CreatedItem::setLangcode() in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 614 of /var/www/html/core/lib/Drupal/Core/Entity/ContentEntityBase.php) #0 /var/www/html/core/lib/Drupal/Core/Entity/ContentEntityBase.php(568): Drupal\Core\Entity\ContentEntityBase->getTranslatedField('created', 'x-default')
#1 /var/www/html/core/modules/rdf/rdf.module(239): Drupal\Core\Entity\ContentEntityBase->get('created')
#2 /var/www/html/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(868): rdf_comment_storage_load(Array)
#3 /var/www/html/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(394): Drupal\Core\Entity\ContentEntityStorageBase->invokeStorageLoadHook(Array)
#4 /var/www/html/core/lib/Drupal/Core/Entity/EntityStorageBase.php(346): Drupal\Core\Entity\Sql\SqlContentEntityStorage->doLoadMultiple(Array)
#5 /var/www/html/core/modules/comment/src/CommentStorage.php(333): Drupal\Core\Entity\EntityStorageBase->loadMultiple(Array)
#6 /var/www/html/core/modules/comment/comment.module(395): Drupal\comment\CommentStorage->loadThread(Object(Drupal\node\Entity\Node), 'field_comments', 1, 50)
#7 [internal function]: comment_node_update_index(Object(Drupal\node\Entity\Node))
#8 /var/www/html/core/lib/Drupal/Core/Extension/ModuleHandler.php(403): call_user_func_array('comment_node_up...', Array)
#9 /var/www/html/core/modules/node/src/Plugin/Search/NodeSearch.php(528): Drupal\Core\Extension\ModuleHandler->invokeAll('node_update_ind...', Array)
#10 /var/www/html/core/modules/node/src/Plugin/Search/NodeSearch.php(489): Drupal\node\Plugin\Search\NodeSearch->indexNode(Object(Drupal\node\Entity\Node))
#11 /var/www/html/core/modules/search/search.module(121): Drupal\node\Plugin\Search\NodeSearch->updateIndex()
#12 [internal function]: search_cron()
#13 /var/www/html/core/lib/Drupal/Core/Extension/ModuleHandler.php(392): call_user_func_array('search_cron', Array)
#14 /var/www/html/core/lib/Drupal/Core/Cron.php(250): Drupal\Core\Extension\ModuleHandler->invoke('search', 'cron')
#15 /var/www/html/core/lib/Drupal/Core/Cron.php(136): Drupal\Core\Cron->invokeCronHandlers()
#16 /var/www/html/core/lib/Drupal/Core/ProxyClass/Cron.php(75): Drupal\Core\Cron->run()
#17 /var/www/html/vendor/drush/drush/src/Drupal/Commands/core/DrupalCommands.php(76): Drupal\Core\ProxyClass\Cron->run()
#18 [internal function]: Drush\Drupal\Commands\core\DrupalCommands->cron(Array)
#19 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#20 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#21 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#22 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(313): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#23 /var/www/html/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 /var/www/html/vendor/symfony/console/Application.php(1027): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /var/www/html/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))
#26 /var/www/html/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#28 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(48): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#29 /var/www/html/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)
#30 /var/www/html/vendor/drush/drush/drush(4): require('/var/www/html/v...')
#31 {main}. 
Error: Call to undefined method Drupal\Core\Field\Plugin\Field\FieldType\CreatedItem::setLangcode() in /var/www/html/core/lib/Drupal/Core/Entity/ContentEntityBase.php on line 614 #0 /var/www/html/core/lib/Drupal/Core/Entity/ContentEntityBase.php(568): Drupal\Core\Entity\ContentEntityBase->getTranslatedField('created', 'x-default')
#1 /var/www/html/core/modules/rdf/rdf.module(239): Drupal\Core\Entity\ContentEntityBase->get('created')
#2 /var/www/html/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(868): rdf_comment_storage_load(Array)
#3 /var/www/html/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(394): Drupal\Core\Entity\ContentEntityStorageBase->invokeStorageLoadHook(Array)
#4 /var/www/html/core/lib/Drupal/Core/Entity/EntityStorageBase.php(346): Drupal\Core\Entity\Sql\SqlContentEntityStorage->doLoadMultiple(Array)
#5 /var/www/html/core/modules/comment/src/CommentStorage.php(333): Drupal\Core\Entity\EntityStorageBase->loadMultiple(Array)
#6 /var/www/html/core/modules/comment/comment.module(395): Drupal\comment\CommentStorage->loadThread(Object(Drupal\node\Entity\Node), 'field_comments', 1, 50)
#7 [internal function]: comment_node_update_index(Object(Drupal\node\Entity\Node))
#8 /var/www/html/core/lib/Drupal/Core/Extension/ModuleHandler.php(403): call_user_func_array('comment_node_up...', Array)
#9 /var/www/html/core/modules/node/src/Plugin/Search/NodeSearch.php(528): Drupal\Core\Extension\ModuleHandler->invokeAll('node_update_ind...', Array)
#10 /var/www/html/core/modules/node/src/Plugin/Search/NodeSearch.php(489): Drupal\node\Plugin\Search\NodeSearch->indexNode(Object(Drupal\node\Entity\Node))
#11 /var/www/html/core/modules/search/search.module(121): Drupal\node\Plugin\Search\NodeSearch->updateIndex()
#12 [internal function]: search_cron()
#13 /var/www/html/core/lib/Drupal/Core/Extension/ModuleHandler.php(392): call_user_func_array('search_cron', Array)
#14 /var/www/html/core/lib/Drupal/Core/Cron.php(250): Drupal\Core\Extension\ModuleHandler->invoke('search', 'cron')
#15 /var/www/html/core/lib/Drupal/Core/Cron.php(136): Drupal\Core\Cron->invokeCronHandlers()
#16 /var/www/html/core/lib/Drupal/Core/ProxyClass/Cron.php(75): Drupal\Core\Cron->run()
#17 /var/www/html/vendor/drush/drush/src/Drupal/Commands/core/DrupalCommands.php(76): Drupal\Core\ProxyClass\Cron->run()
#18 [internal function]: Drush\Drupal\Commands\core\DrupalCommands->cron(Array)
#19 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#20 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#21 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#22 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(313): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#23 /var/www/html/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 /var/www/html/vendor/symfony/console/Application.php(1027): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /var/www/html/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))
#26 /var/www/html/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#28 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(48): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#29 /var/www/html/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)
#30 /var/www/html/vendor/drush/drush/drush(4): require('/var/www/html/v...')
#31 {main}
Error: Call to undefined method Drupal\Core\Field\Plugin\Field\FieldType\CreatedItem::setLangcode() in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 614 of /var/www/html/core/lib/Drupal/Core/Entity/ContentEntityBase.php).
 [warning] Drush command terminated abnormally.

Steps to reproduce

I can only reproduce this on my production database, so I'll set this to "support request".

What would be the best way to debug this?

Comments

alberto56 created an issue. See original summary.

alberto56’s picture

Category: Bug report » Support request
alberto56’s picture

If I put some debugging code just before the exception is thrown, I see that the offending entity is Comment with ID 4.

When I visit /admin/content/comment I get the same error. Looks like my comments might be corrupted?

cilefen’s picture

Try uninstalling the RDF module.

alberto56’s picture

Status: Active » Fixed

Good idea, thanks. Unfortunately I'm still getting a fatal error:

root@86d202f356f0:/var/www/html# drush pmu rdf
 [success] Successfully uninstalled: rdf
root@86d202f356f0:/var/www/html# drush cr
 [success] Cache rebuild complete.
root@86d202f356f0:/var/www/html# drush cron
 [error]  Error: Call to undefined method Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem::setLangcode() in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 614 of /var/www/html/core/lib/Drupal/Core/Entity/ContentEntityBase.php) #0 /var/www/html/core/lib/Drupal/Core/Entity/ContentEntityBase.php(568): Drupal\Core\Entity\ContentEntityBase->getTranslatedField('entity_id', 'x-default')
#1 /var/www/html/core/modules/comment/src/Entity/Comment.php(356): Drupal\Core\Entity\ContentEntityBase->get('entity_id')
#2 /var/www/html/core/modules/comment/src/CommentViewBuilder.php(83): Drupal\comment\Entity\Comment->getCommentedEntity()
#3 /var/www/html/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(157): Drupal\comment\CommentViewBuilder->getBuildDefaults(Object(Drupal\comment\Entity\Comment), 'full')
#4 /var/www/html/core/modules/comment/comment.module(397): Drupal\Core\Entity\EntityViewBuilder->viewMultiple(Array)
#5 [internal function]: comment_node_update_index(Object(Drupal\node\Entity\Node))
#6 /var/www/html/core/lib/Drupal/Core/Extension/ModuleHandler.php(403): call_user_func_array('comment_node_up...', Array)
#7 /var/www/html/core/modules/node/src/Plugin/Search/NodeSearch.php(528): Drupal\Core\Extension\ModuleHandler->invokeAll('node_update_ind...', Array)
#8 /var/www/html/core/modules/node/src/Plugin/Search/NodeSearch.php(489): Drupal\node\Plugin\Search\NodeSearch->indexNode(Object(Drupal\node\Entity\Node))
#9 /var/www/html/core/modules/search/search.module(121): Drupal\node\Plugin\Search\NodeSearch->updateIndex()
#10 [internal function]: search_cron()
#11 /var/www/html/core/lib/Drupal/Core/Extension/ModuleHandler.php(392): call_user_func_array('search_cron', Array)
#12 /var/www/html/core/lib/Drupal/Core/Cron.php(250): Drupal\Core\Extension\ModuleHandler->invoke('search', 'cron')
#13 /var/www/html/core/lib/Drupal/Core/Cron.php(136): Drupal\Core\Cron->invokeCronHandlers()
#14 /var/www/html/core/lib/Drupal/Core/ProxyClass/Cron.php(75): Drupal\Core\Cron->run()
#15 /var/www/html/vendor/drush/drush/src/Drupal/Commands/core/DrupalCommands.php(76): Drupal\Core\ProxyClass\Cron->run()
#16 [internal function]: Drush\Drupal\Commands\core\DrupalCommands->cron(Array)
#17 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#18 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#19 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#20 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(313): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#21 /var/www/html/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /var/www/html/vendor/symfony/console/Application.php(1027): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /var/www/html/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))
#24 /var/www/html/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(48): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 /var/www/html/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)
#28 /var/www/html/vendor/drush/drush/drush(4): require('/var/www/html/v...')
#29 {main}. 
Error: Call to undefined method Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem::setLangcode() in /var/www/html/core/lib/Drupal/Core/Entity/ContentEntityBase.php on line 614 #0 /var/www/html/core/lib/Drupal/Core/Entity/ContentEntityBase.php(568): Drupal\Core\Entity\ContentEntityBase->getTranslatedField('entity_id', 'x-default')
#1 /var/www/html/core/modules/comment/src/Entity/Comment.php(356): Drupal\Core\Entity\ContentEntityBase->get('entity_id')
#2 /var/www/html/core/modules/comment/src/CommentViewBuilder.php(83): Drupal\comment\Entity\Comment->getCommentedEntity()
#3 /var/www/html/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(157): Drupal\comment\CommentViewBuilder->getBuildDefaults(Object(Drupal\comment\Entity\Comment), 'full')
#4 /var/www/html/core/modules/comment/comment.module(397): Drupal\Core\Entity\EntityViewBuilder->viewMultiple(Array)
#5 [internal function]: comment_node_update_index(Object(Drupal\node\Entity\Node))
#6 /var/www/html/core/lib/Drupal/Core/Extension/ModuleHandler.php(403): call_user_func_array('comment_node_up...', Array)
#7 /var/www/html/core/modules/node/src/Plugin/Search/NodeSearch.php(528): Drupal\Core\Extension\ModuleHandler->invokeAll('node_update_ind...', Array)
#8 /var/www/html/core/modules/node/src/Plugin/Search/NodeSearch.php(489): Drupal\node\Plugin\Search\NodeSearch->indexNode(Object(Drupal\node\Entity\Node))
#9 /var/www/html/core/modules/search/search.module(121): Drupal\node\Plugin\Search\NodeSearch->updateIndex()
#10 [internal function]: search_cron()
#11 /var/www/html/core/lib/Drupal/Core/Extension/ModuleHandler.php(392): call_user_func_array('search_cron', Array)
#12 /var/www/html/core/lib/Drupal/Core/Cron.php(250): Drupal\Core\Extension\ModuleHandler->invoke('search', 'cron')
#13 /var/www/html/core/lib/Drupal/Core/Cron.php(136): Drupal\Core\Cron->invokeCronHandlers()
#14 /var/www/html/core/lib/Drupal/Core/ProxyClass/Cron.php(75): Drupal\Core\Cron->run()
#15 /var/www/html/vendor/drush/drush/src/Drupal/Commands/core/DrupalCommands.php(76): Drupal\Core\ProxyClass\Cron->run()
#16 [internal function]: Drush\Drupal\Commands\core\DrupalCommands->cron(Array)
#17 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#18 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#19 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#20 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(313): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#21 /var/www/html/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /var/www/html/vendor/symfony/console/Application.php(1027): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /var/www/html/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))
#24 /var/www/html/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(48): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 /var/www/html/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)
#28 /var/www/html/vendor/drush/drush/drush(4): require('/var/www/html/v...')
#29 {main}
Error: Call to undefined method Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem::setLangcode() in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 614 of /var/www/html/core/lib/Drupal/Core/Entity/ContentEntityBase.php).
 [warning] Drush command terminated abnormally.

I also get an error on /comment/4:

The website encountered an unexpected error. Please try again later.
Error: Call to undefined method Drupal\Core\Field\Plugin\Field\FieldType\StringItem::setLangcode() in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 614 of core/lib/Drupal/Core/Entity/ContentEntityBase.php).
Drupal\Core\Entity\ContentEntityBase->getTranslatedField('thread', 'x-default') (Line: 568)
Drupal\Core\Entity\ContentEntityBase->get('thread') (Line: 487)
Drupal\comment\Entity\Comment->getThread() (Line: 127)
Drupal\comment\CommentViewBuilder->buildComponents(Array, Array, Array, 'default') (Line: 282)
Drupal\Core\Entity\EntityViewBuilder->buildMultiple(Array)
call_user_func_array(Array, Array) (Line: 101)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 772)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 363)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 201)
Drupal\Core\Render\Renderer->render(Array) (Line: 463)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 65)
__TwigTemplate_83caf9f88e25e2c2258c044fa8a1ed870537527aadbda880868fe63ef3f4d6dc->doDisplay(Array, Array) (Line: 405)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)
Twig\Template->display(Array) (Line: 390)
Twig\Template->render(Array) (Line: 55)
twig_render_template('core/modules/comment/templates/field--comment.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render('field', Array) (Line: 422)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 435)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 201)
Drupal\Core\Render\Renderer->render(Array) (Line: 463)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 107)
__TwigTemplate_fb402075882954663ef3491ff8e06dfb50f31f6b5d5909e7b418716751293d07->doDisplay(Array, Array) (Line: 405)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)
Twig\Template->display(Array) (Line: 390)
Twig\Template->render(Array) (Line: 55)
twig_render_template('themes/contrib/bootstrap/templates/node/node.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render('node', Array) (Line: 422)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 201)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 241)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 564)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 242)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 132)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 163)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 2) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 2, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 2, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 2, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 2, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 2, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 2, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 2, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 2) (Line: 152)
Drupal\comment\Controller\CommentController->commentPermalink(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 564)
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: 158)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
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: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

On a copy of the database, I tried deleting all comments, but I still get an error:

root@86d202f356f0:/var/www/html# drush php

Psy Shell v0.10.12 (PHP 7.4.26 — cli) by Justin Hileman
Ahora (Drupal 9.3.0)
>>> 
>>> foreach (\Drupal\comment\Entity\Comment::loadMultiple() as $comment) {
... $comment->delete();
... }
PHP Error:  Call to undefined method Drupal\Core\Field\Plugin\Field\FieldType\IntegerItem::setLangcode() in /var/www/html/core/lib/Drupal/Core/Entity/ContentEntityBase.php on line 614

I then tried to uninstall content_translation, and that worked:

root@86d202f356f0:/var/www/html# drush pmu content_translation
 [success] Successfully uninstalled: content_translation
root@86d202f356f0:/var/www/html# drush cron

however I need Content tranlation, so I tried reinstalling it. And that seems to work:

root@86d202f356f0:/var/www/html# drush en -y content_translation
>  [warning] No configuration objects have been updated.
>  [notice] Message: No configuration objects have been updated.
> 
 [success] Successfully enabled: content_translation
root@86d202f356f0:/var/www/html# drush cron

I made a diff of my database dump which was failing, and the database dump after I had disabled and re-enabled content_translation, and the major difference was that the failing database did not have the node__comment table, but the database did have this table after I disabled and re-enabled content_translation.

I will set close this for now, unless I come up with something more meaty!

Thanks again for your help.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.