Problem/Motivation
Problem with another web site after upgrading it to 11.3.2
Other upgrades applied at te same time :
mimemail
token
solo utilities
solo theme
I also have applied the patch in ThemeRegistry.php
+#3564510: TypeError: Drupal\Core\Utility\ThemeRegistry::getGlobalPreprocess(): Return value must be of type array
When I tried to run update.php I got the "unexpected error" message.
Now when I try to access to the site, I also get the "unexpected error" message.
This is what is reported in the web server logs.
[Sun Jan 11 14:31:54 2026] [X-OVHRequest-Id: 8dacd6a65072552bff3f2a8c83f6b6c0] [error] [client 2a01:cb10:873:e700:f13a:3e7a:afda:de34:0] [host www.tribupierre.net] AH10131: FastCGI: server "/homez.2186/tribupv/www/index.php" stderr: PHP message: Uncaught PHP Exception ArgumentCountError: "Too few arguments to function Drupal\\token\\Hook\\TokenHooks::__construct(), 0 passed in /home/tribupv/www/core/lib/Drupal/Core/DependencyInjection/ClassResolver.php on line 39 and exactly 3 expected" at /home/tribupv/www/modules/token/src/Hook/TokenHooks.php line 22
[Sun Jan 11 14:32:10 2026] [X-OVHRequest-Id: 4e9f357c081606bed8f2b04d86c9165c] [error] [client 2a01:cb10:873:e700:f13a:3e7a:afda:de34:0] [host www.tribupierre.net] AH10131: FastCGI: server "/homez.2186/tribupv/www/index.php" stderr: PHP message: Uncaught PHP Exception ArgumentCountError: "Too few arguments to function Drupal\\token\\Hook\\TokenHooks::__construct(), 0 passed in /home/tribupv/www/core/lib/Drupal/Core/DependencyInjection/ClassResolver.php on line 39 and exactly 3 expected" at /home/tribupv/www/modules/token/src/Hook/TokenHooks.php line 22
[Sun Jan 11 14:32:30 2026] [X-OVHRequest-Id: 16772be0668b5f8c5b710fb634d10bdd] [error] [client 2a01:cb10:873:e700:f13a:3e7a:afda:de34:0] [host www.tribupierre.net] AH10131: FastCGI: server "/homez.2186/tribupv/www/index.php" stderr: PHP message: Uncaught PHP Exception ArgumentCountError: "Too few arguments to function Drupal\\token\\Hook\\TokenHooks::__construct(), 0 passed in /home/tribupv/www/core/lib/Drupal/Core/DependencyInjection/ClassResolver.php on line 39 and exactly 3 expected" at /home/tribupv/www/modules/token/src/Hook/TokenHooks.php line 22
Thanks for your help.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | DrupalToken260112.png | 24.24 KB | dpierre |
Comments
Comment #2
cilefen commentedThis is the sixth report.
Comment #4
cilefen commentedI am sorry I misread this. It looks like a problem with the Token module.
Comment #5
dpierreReverting from Token 8.1.17 to 8.1.16 does not solve the problem.
It might be linked to Drupal core upgrade (or to incorrect interaction between Token and modifications introduced in Drupal 11.3.2).
There were no such problems with Drupal 11.2.8 (and Token 8.1.16)
Web server log with Drupal 11.3.2 and Token 8.1.16 when trying to login.
[Sun Jan 11 15:51:40 2026] [X-OVHRequest-Id: 133d6ca9fb5332d6850cb66749f448c0] [error] [client 2a01:cb10:873:e700:7c3f:4a64:1ec5:4c1a:0] [host www.tribupierre.net] AH10131: FastCGI: server "/homez.2186/tribupv/www/index.php" stderr: PHP message: Uncaught PHP Exception ArgumentCountError: "Too few arguments to function Drupal\\token\\Hook\\TokenHooks::__construct(), 0 passed in /home/tribupv/www/core/lib/Drupal/Core/DependencyInjection/ClassResolver.php on line 39 and exactly 3 expected" at /home/tribupv/www/modules/token/src/Hook/TokenHooks.php line 22
Comment #6
dpierreThe problem might no come from the Token module.
I have upgraded another site with Drupal 11.3.2 and Token 8.1.17 and it's OK.
Comment #7
dpierreI have downgraded the site to Drupal 11.2.8 (withToken 8.1.16).
The site itself works correctly.
But when I run update.php I get the message : "unexpected error".
See web server logs :
Sun Jan 11 23:11:51 2026] [X-OVHRequest-Id: d440141bda6da15701c8279ec19e72fb] [error] [client 2a01:cb10:873:e700:c47f:d622:2ec6:c2b6:0] [host www.tribupierre.net] AH10039: FastCGI: server "/homez.2186/tribupv/www/update.php" stderr: PHP message: Error: Class "Doctrine\\Common\\Annotations\\TokenParser" not found in /home/tribupv/www/core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionParser.php on line 192 #0 /home/tribupv/www/core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionParser.php(329): Drupal\\Component\\Annotation\\Doctrine\\StaticReflectionParser->parse()
[Sun Jan 11 23:11:51 2026] [X-OVHRequest-Id: d440141bda6da15701c8279ec19e72fb] [error] [client 2a01:cb10:873:e700:c47f:d622:2ec6:c2b6:0] [host www.tribupierre.net] AH10039: FastCGI: server "/homez.2186/tribupv/www/update.php" stderr: #1 /home/tribupv/www/core/lib/Drupal/Core/Hook/HookCollectorPass.php(451): Drupal\\Component\\Annotation\\Doctrine\\StaticReflectionParser->getMethodAttributes()
[Sun Jan 11 23:11:51 2026] [X-OVHRequest-Id: d440141bda6da15701c8279ec19e72fb] [error] [client 2a01:cb10:873:e700:c47f:d622:2ec6:c2b6:0] [host www.tribupierre.net] AH10039: FastCGI: server "/homez.2186/tribupv/www/update.php" stderr: #2 /home/tribupv/www/core/lib/Drupal/Core/Hook/HookCollectorPass.php(375): Drupal\\Core\\Hook\\HookCollectorPass->collectModuleHookImplementations('modules/advance...', 'advancedqueue', '/^(?(...', false)
[Sun Jan 11 23:11:51 2026] [X-OVHRequest-Id: d440141bda6da15701c8279ec19e72fb] [error] [client 2a01:cb10:873:e700:c47f:d622:2ec6:c2b6:0] [host www.tribupierre.net] AH10039: FastCGI: server "/homez.2186/tribupv/www/update.php" stderr: #3 /home/tribupv/www/core/lib/Drupal/Core/Hook/HookCollectorPass.php(137): Drupal\\Core\\Hook\\HookCollectorPass::collectAllHookImplementations(Array, Array)
[Sun Jan 11 23:11:51 2026] [X-OVHRequest-Id: d440141bda6da15701c8279ec19e72fb] [error] [client 2a01:cb10:873:e700:c47f:d622:2ec6:c2b6:0] [host www.tribupierre.net] AH10131: FastCGI: server "/homez.2186/tribupv/www/update.php" stderr: #4 /home/tribupv/www/vendor/symfony/dependency-injection/Compiler/Compiler.php(73): Drupal\\Core\\Hook\\HookCollectorPass->process(Object...octrine/StaticReflectionParser.php on line 192 #0 /home/tribupv/www/core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionParser.php(329): Drupal\\Component\\Annotation\\Doctrine\\StaticReflectionParser->parse()
Comment #8
dpierreKeeping Drupal downgrade to 11.2.8, I have upgraded the site from Token 8.1.16 to 8.1.17.
Login on the site works. Once logged, all other actions (except logout) lead to "unexpected error".
Web server logs :
[Sun Jan 11 23:23:25 2026] [X-OVHRequest-Id: 3548946078923d61c3cb4d334961ea04] [error] [client 2a01:cb10:873:e700:c47f:d622:2ec6:c2b6:0] [host www.tribupierre.net] AH10131: FastCGI: server "/homez.2186/tribupv/www/index.php" stderr: PHP message: Uncaught PHP Exception Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException: "You have requested a non-existent service "Drupal\\token\\Hook\\TokenHooks". Did you mean one of these: "Drupal\\user\\Hook\\UserHooks", "Drupal\\comment\\Hook\\CommentHooks", "Drupal\\file\\Hook\\CronHook", "Drupal\\node\\Hook\\NodeHooks1", "Drupal\\file\\Hook\\FileHooks", "Drupal\\text\\Hook\\TextHooks", "Drupal\\node\\Hook\\NodeHooks", "Drupal\\file\\Hook\\TokenHooks", "Drupal\\node\\Hook\\NodeTokensHooks", "Drupal\\user\\Hook\\UserTokensHooks"?" at /home/tribupv/www/core/lib/Drupal/Component/DependencyInjection/Container.php line 157
[Sun Jan 11 23:25:31 2026] [X-OVHRequest-Id: e7e327adbea70e372b2125d5df5f9763] [error] [client 2a01:cb10:873:e700:c47f:d622:2ec6:c2b6:0] [host www.tribupierre.net] AH10131: FastCGI: server "/homez.2186/tribupv/www/index.php" stderr: PHP message: Uncaught PHP Exception Error: "Class "Doctrine\\Common\\Annotations\\AnnotationRegistry" not found" at /home/tribupv/www/core/lib/Drupal/Core/Plugin/Discovery/AttributeDiscoveryWithAnnotations.php line 65
[Sun Jan 11 23:25:44 2026] [X-OVHRequest-Id: 4d698eb5b0ded674f6f2bcfd9f57793c] [error] [client 2a01:cb10:873:e700:c47f:d622:2ec6:c2b6:0] [host www.tribupierre.net] AH10131: FastCGI: server "/homez.2186/tribupv/www/index.php" stderr: PHP message: Uncaught PHP Exception Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException: "You have requested a non-existent service "Drupal\\token\\Hook\\TokenHooks". Did you mean one of these: "Drupal\\comment\\Hook\\CommentHooks", "Drupal\\file\\Hook\\CronHook", "Drupal\\node\\Hook\\NodeHooks1", "Drupal\\file\\Hook\\FileHooks", "Drupal\\user\\Hook\\UserHooks", "Drupal\\text\\Hook\\TextHooks", "Drupal\\node\\Hook\\NodeHooks", "Drupal\\file\\Hook\\TokenHooks", "Drupal\\node\\Hook\\NodeTokensHooks", "Drupal\\user\\Hook\\UserTokensHooks"?" at /home/tribupv/www/core/lib/Drupal/Component/DependencyInjection/Container.php line 157
[Sun Jan 11 23:26:03 2026] [X-OVHRequest-Id: f1a224b81e56765bbea7197caa525d0e] [error] [client 2a01:cb10:873:e700:c47f:d622:2ec6:c2b6:0] [host www.tribupierre.net] AH10131: FastCGI: server "/homez.2186/tribupv/www/index.php" stderr: PHP message: Uncaught PHP Exception Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException: "You have requested a non-existent service "Drupal\\token\\Hook\\TokenHooks". Did you mean one of these: "Drupal\\comment\\Hook\\CommentHooks", "Drupal\\file\\Hook\\CronHook", "Drupal\\node\\Hook\\NodeHooks1", "Drupal\\file\\Hook\\FileHooks", "Drupal\\user\\Hook\\UserHooks", "Drupal\\text\\Hook\\TextHooks", "Drupal\\node\\Hook\\NodeHooks", "Drupal\\file\\Hook\\TokenHooks", "Drupal\\node\\Hook\\NodeTokensHooks", "Drupal\\user\\Hook\\UserTokensHooks"?" at /home/tribupv/www/core/lib/Drupal/Component/DependencyInjection/Container.php line 157
Comment #9
berdirRun updates, clear caches. If that doesn't work, Enable verbose error reporting (through settings.php), and post the error.
If you still get this error after downgrading token, you did not actually downgrade it.
Comment #10
dpierreThanks for your message.
Updates : I cannot run update.php, it leads o "unexpected error"
Caches : Do you mean browser's caches ? or other caches ?
Verbose error reporting : I looked into settings.php and did not find where to enable this.
Drupal 11.2.8 and Token 8.1.16 (see screenshot from "available updates") are implemented.
This is what I get (web server logs) when I invoke /admin/config and update.php.
[Tue Jan 13 12:03:24 2026] [X-OVHRequest-Id: 2300054ce11352638f537e2feb183b95] [error] [client 2a01:cb10:873:e700:b018:2120:a71f:d70c:0] [host www.tribupierre.net] AH10131: FastCGI: server "/homez.2186/tribupv/www/index.php" stderr: PHP message: Uncaught PHP Exception Error: "Class "Doctrine\\Common\\Annotations\\AnnotationRegistry" not found" at /home/tribupv/www/core/lib/Drupal/Core/Plugin/Discovery/AttributeDiscoveryWithAnnotations.php line 65
[Tue Jan 13 12:09:36 2026] [X-OVHRequest-Id: e886847664ca1486fa334d2a2aa6b87b] [error] [client 2a01:cb10:873:e700:b018:2120:a71f:d70c:0] [host www.tribupierre.net] AH10131: FastCGI: server "/homez.2186/tribupv/www/index.php" stderr: PHP message: Uncaught PHP Exception Error: "Class "Doctrine\\Common\\Annotations\\AnnotationRegistry" not found" at /home/tribupv/www/core/lib/Drupal/Core/Plugin/Discovery/AttributeDiscoveryWithAnnotations.php line 65
[Tue Jan 13 12:09:48 2026] [X-OVHRequest-Id: c5aa27bbffbbe747eaa48bc4c43b4718] [error] [client 2a01:cb10:873:e700:b018:2120:a71f:d70c:0] [host www.tribupierre.net] AH10039: FastCGI: server "/homez.2186/tribupv/www/update.php" stderr: PHP message: Error: Class "Doctrine\\Common\\Annotations\\TokenParser" not found in /home/tribupv/www/core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionParser.php on line 192 #0 /home/tribupv/www/core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionParser.php(329): Drupal\\Component\\Annotation\\Doctrine\\StaticReflectionParser->parse()
[Tue Jan 13 12:09:48 2026] [X-OVHRequest-Id: c5aa27bbffbbe747eaa48bc4c43b4718] [error] [client 2a01:cb10:873:e700:b018:2120:a71f:d70c:0] [host www.tribupierre.net] AH10039: FastCGI: server "/homez.2186/tribupv/www/update.php" stderr: #1 /home/tribupv/www/core/lib/Drupal/Core/Hook/HookCollectorPass.php(451): Drupal\\Component\\Annotation\\Doctrine\\StaticReflectionParser->getMethodAttributes()
[Tue Jan 13 12:09:48 2026] [X-OVHRequest-Id: c5aa27bbffbbe747eaa48bc4c43b4718] [error] [client 2a01:cb10:873:e700:b018:2120:a71f:d70c:0] [host www.tribupierre.net] AH10039: FastCGI: server "/homez.2186/tribupv/www/update.php" stderr: #2 /home/tribupv/www/core/lib/Drupal/Core/Hook/HookCollectorPass.php(375): Drupal\\Core\\Hook\\HookCollectorPass->collectModuleHookImplementations('modules/advance...', 'advancedqueue', '/^(?(...', false)
[Tue Jan 13 12:09:48 2026] [X-OVHRequest-Id: c5aa27bbffbbe747eaa48bc4c43b4718] [error] [client 2a01:cb10:873:e700:b018:2120:a71f:d70c:0] [host www.tribupierre.net] AH10039: FastCGI: server "/homez.2186/tribupv/www/update.php" stderr: #3 /home/tribupv/www/core/lib/Drupal/Core/Hook/HookCollectorPass.php(137): Drupal\\Core\\Hook\\HookCollectorPass::collectAllHookImplementations(Array, Array)
[Tue Jan 13 12:09:48 2026] [X-OVHRequest-Id: c5aa27bbffbbe747eaa48bc4c43b4718] [error] [client 2a01:cb10:873:e700:b018:2120:a71f:d70c:0] [host www.tribupierre.net] AH10131: FastCGI: server "/homez.2186/tribupv/www/update.php" stderr: #4 /home/tribupv/www/vendor/symfony/dependency-injection/Compiler/Compiler.php(73): Drupal\\Core\\Hook\\HookCollectorPass->process(Object...octrine/StaticReflectionParser.php on line 192 #0 /home/tribupv/www/core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionParser.php(329): Drupal\\Component\\Annotation\\Doctrine\\StaticReflectionParser->parse()
When I upgrade to token 8.1.17 I get "unexpected error" for any actions except login. As indicated in #8
Comment #11
ranchoalegre commentedI had the same problem as @dpierre above. I updated Token, then got the 500 error on the homepage. I then attempted to revert to the previous version of Token and then my site stopped working altogether. Thankfully, it was a dev site that I was migrating from another server.
Now all I get is this:
The website encountered an unexpected error. Try again later.
Symfony\Component\DependencyInjection\Exception\RuntimeException: Cannot autowire service "Drupal\token\Hook\TokenHooks": argument "$treeBuilder" of method "__construct()" references interface "Drupal\token\TreeBuilderInterface" but no such service exists. You should maybe alias this interface to the existing "token.tree_builder" service. in Symfony\Component\DependencyInjection\Compiler\DefinitionErrorExceptionPass->process() (line 48 of vendor/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php).
Symfony\Component\DependencyInjection\Compiler\DefinitionErrorExceptionPass->process() (Line: 73)
Symfony\Component\DependencyInjection\Compiler\Compiler->compile() (Line: 820)
Symfony\Component\DependencyInjection\ContainerBuilder->compile() (Line: 1519)
Drupal\Core\DrupalKernel->compileContainer() (Line: 1028)
Drupal\Core\DrupalKernel->initializeContainer() (Line: 524)
Drupal\Core\DrupalKernel->boot() (Line: 743)
Drupal\Core\DrupalKernel->handle() (Line: 19)
Comment #12
berdir#10 looks like you're missing the doctrine/annotations library and something depends on that. See https://www.drupal.org/node/3551049 and try to require that explicitly. This library is unsupported and core had to fork and switch away from it. This should help in the short term, but you'll need to figure who uses that without depending on it.
#11: I don't think that's the same or even a similar problem. It mentions the same class, but the error is different. No idea why you get that. you may be using patches or somehow have multiple versions of token or some other super weird scenario. Token 8.x-1.17 is tested on D10 and should work fine there. You might get a different error if you are using the latest version. Make sure you only have one version of token, no patches, test on latest version, visit update.php and so on.