Problem/Motivation

After upgrading to 11.3 I get the following error:

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "comment.manager". Did you mean one of these: "theme.manager", "context.manager", "config.manager"? in Drupal\Component\DependencyInjection\Container->get() (line 157 of /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php).

Trace:

#0 /var/www/html/web/core/lib/Drupal.php(205): Drupal\Component\DependencyInjection\Container->get()
#1 /var/www/html/web/core/modules/history/src/Hook/HistoryTokensHooks.php(30): Drupal::service()
#2 [internal function]: Drupal\history\Hook\HistoryTokensHooks->tokenInfo()
#3 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(389): call_user_func_array()
#4 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(340): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}()
#5 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(388): Drupal\Core\Extension\ModuleHandler->invokeAllWith()
#6 /var/www/html/web/modules/contrib/token/src/Token.php(40): Drupal\Core\Extension\ModuleHandler->invokeAll()
#7 /var/www/html/web/modules/contrib/token/src/Token.php(100): Drupal\token\Token->getInfo()
#8 /var/www/html/web/modules/contrib/token/src/TokenModuleProvider.php(57): Drupal\token\Token->getTokenInfo()
#9 /var/www/html/web/core/lib/Drupal/Core/Cache/CacheCollector.php(149): Drupal\token\TokenModuleProvider->resolveCacheMiss()
#10 /var/www/html/web/modules/contrib/token/src/TokenModuleProvider.php(49): Drupal\Core\Cache\CacheCollector->get()
#11 /var/www/html/web/modules/contrib/token/token.tokens.inc(1754): Drupal\token\TokenModuleProvider->getTokenModule()
#12 /var/www/html/web/modules/contrib/token/token.tokens.inc(503): _field_tokens()
#13 [internal function]: token_tokens()
#14 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(389): call_user_func_array()
#15 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(340): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}()
#16 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(388): Drupal\Core\Extension\ModuleHandler->invokeAllWith()
#17 /var/www/html/web/core/lib/Drupal/Core/Utility/Token.php(364): Drupal\Core\Extension\ModuleHandler->invokeAll()
#18 /var/www/html/web/modules/contrib/token/token.tokens.inc(1097): Drupal\Core\Utility\Token->generate()
#19 [internal function]: token_tokens()
#20 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(389): call_user_func_array()
#21 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(340): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}()
#22 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(388): Drupal\Core\Extension\ModuleHandler->invokeAllWith()
#23 /var/www/html/web/core/lib/Drupal/Core/Utility/Token.php(364): Drupal\Core\Extension\ModuleHandler->invokeAll()
#24 /var/www/html/web/core/lib/Drupal/Core/Utility/Token.php(245): Drupal\Core\Utility\Token->generate()
#25 /var/www/html/web/core/lib/Drupal/Core/Utility/Token.php(195): Drupal\Core\Utility\Token->doReplace()
#26 /var/www/html/web/modules/contrib/metatag/src/MetatagToken.php(66): Drupal\Core\Utility\Token->replace()
#27 /var/www/html/web/modules/contrib/metatag/src/MetatagManager.php(791): Drupal\metatag\MetatagToken->replace()
#28 /var/www/html/web/modules/contrib/metatag/src/MetatagManager.php(634): Drupal\metatag\MetatagManager->processTagValue()
#29 /var/www/html/web/modules/contrib/metatag/src/MetatagManager.php(573): Drupal\metatag\MetatagManager->generateRawElements()
#30 /var/www/html/web/modules/contrib/metatag/metatag.module(510): Drupal\metatag\MetatagManager->generateElements()
#31 /var/www/html/web/modules/contrib/metatag/metatag.module(264): metatag_get_tags_from_route()
#32 /var/www/html/web/modules/contrib/metatag/metatag.module(224): _metatag_remove_duplicate_entity_tags()
#33 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(460): metatag_entity_view_alter()
#34 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(306): Drupal\Core\Extension\ModuleHandler->alter()
#35 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(240): Drupal\Core\Entity\EntityViewBuilder->buildMultiple()
#36 [internal function]: Drupal\Core\Entity\EntityViewBuilder->build()
#37 /var/www/html/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(107): call_user_func_array()
#38 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(910): Drupal\Core\Render\Renderer->doTrustedCallback()
#39 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(441): Drupal\Core\Render\Renderer->doCallback()
#40 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(230): Drupal\Core\Render\Renderer->doRender()
#41 /var/www/html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(242): Drupal\Core\Render\Renderer->render()
#42 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(634): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
#43 [internal function]: Drupal\Core\Render\Renderer::Drupal\Core\Render\{closure}()
#44 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(649): Fiber->resume()
#45 /var/www/html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(235): Drupal\Core\Render\Renderer->executeInRenderContext()
#46 /var/www/html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(131): Drupal\Core\Render\MainContent\HtmlRenderer->prepare()
#47 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse()
#48 /var/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php(246): Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
#49 /var/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php(206): Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}()
#50 /var/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php(56): Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
#51 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(188): Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
#52 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#53 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#54 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#55 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#56 /var/www/html/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
#57 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(118): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#58 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(92): Drupal\page_cache\StackMiddleware\PageCache->pass()
#59 /var/www/html/vendor/asm89/stack-cors/src/Cors.php(53): Drupal\page_cache\StackMiddleware\PageCache->handle()
#60 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Asm89\Stack\Cors->handle()
#61 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#62 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(53): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#63 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(54): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#64 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(745): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#65 /var/www/html/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#66 {main}

Workaround

Disabling the history module is the workaround for now.

Still have to look into was causes this.

Comments

f0ns created an issue. See original summary.

f0ns’s picture

Just did a quick check and found some occurences of comment.manager

in the history module

in history.services.yml on line 9:

arguments: ['@history.comment_link_builder.inner', '@comment.manager', '@current_user', '@entity_type.manager', '@Drupal\history\HistoryManager']

and in /src/Hook/HistoryTokensHook.php on line 30:

if (\Drupal::service('comment.manager')->getFields($entity_type_id)) {

f0ns’s picture

Just checked and enabling the comment module also is a workaround so I think the best solution is to have a check if it's enabled in history to keep it from throwing this error.

longwave’s picture

cilefen’s picture

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.