The website encountered an unexpected error. Try again later.
Error: Maximum call stack size of 8339456 bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? in Drupal\Core\Entity\ContentEntityBase->Drupal\Core\Entity\{closure}() (line 1042 of core/lib/Drupal/Core/Entity/ContentEntityBase.php).
array_filter() (Line: 1041)
Drupal\Core\Entity\ContentEntityBase->getTranslationLanguages() (Line: 97)
Drupal\Core\Entity\EntityRepository->getTranslationFromContext() (Line: 1735)
_field_tokens() (Line: 503)
token_tokens()
call_user_func_array() (Line: 416)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}() (Line: 395)
Drupal\Core\Extension\ModuleHandler->invokeAllWith() (Line: 415)
Drupal\Core\Extension\ModuleHandler->invokeAll() (Line: 364)
Drupal\Core\Utility\Token->generate() (Line: 1097)
token_tokens()
call_user_func_array() (Line: 416)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}() (Line: 395)
Drupal\Core\Extension\ModuleHandler->invokeAllWith() (Line: 415)
Drupal\Core\Extension\ModuleHandler->invokeAll() (Line: 364)
Drupal\Core\Utility\Token->generate() (Line: 241)
Drupal\Core\Utility\Token->doReplace() (Line: 191)
Drupal\Core\Utility\Token->replace() (Line: 152)
Drupal\webform\WebformTokenManager->replace() (Line: 171)
Drupal\webform\WebformTokenManager->replaceNoRenderContext() (Line: 261)
Drupal\webform\Entity\WebformSubmission->label() (Line: 105)
Drupal\webform\Controller\WebformSubmissionViewController->title()
call_user_func_array() (Line: 58)
Drupal\Core\Controller\TitleResolver->getTitle() (Line: 880)
token_tokens()
call_user_func_array() (Line: 416)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}() (Line: 395)
Drupal\Core\Extension\ModuleHandler->invokeAllWith() (Line: 415)
Drupal\Core\Extension\ModuleHandler->invokeAll() (Line: 364)
Drupal\Core\Utility\Token->generate() (Line: 241)
Drupal\Core\Utility\Token->doReplace() (Line: 191)
Drupal\Core\Utility\Token->replace() (Line: 66)
Drupal\metatag\MetatagToken->replace() (Line: 791)
Drupal\metatag\MetatagManager->processTagValue() (Line: 634)
Drupal\metatag\MetatagManager->generateRawElements() (Line: 61)
Drupal\metatag\Plugin\Field\MetatagEntityFieldItemList::Drupal\metatag\Plugin\Field\{closure}() (Line: 637)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 48)
Drupal\metatag\Plugin\Field\MetatagEntityFieldItemList->computeValue() (Line: 32)
Drupal\metatag\Plugin\Field\MetatagEntityFieldItemList->ensureComputedValue() (Line: 43)
Drupal\metatag\Plugin\Field\MetatagEntityFieldItemList->getValue() (Line: 723)
Drupal\Core\Entity\ContentEntityBase->toArray() (Line: 950)
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | error-stack.txt | 30.59 MB | pemson18 |
| #9 | recursion-error-metatag.txt | 32.53 MB | pemson18 |
| #2 | fix_recursion.patch | 1.62 KB | wmcmillian |
Comments
Comment #2
wmcmillian commentedI added a patch for this.
The issue is that the tokens function pulls in all of the tags attached to an entity and then runs token replace on them. If any of the tags reference via token any other tag, this causes a recursion.
This patch filters the tags being processed to only those being referenced by token and should ignore any tag value that references itself.
Comment #3
damienmckennaDo you have an example of a token that triggers the problem?
Comment #4
jmee commentedI ran into this behaviour when enabling the metatag module (2.2.0) on an existing Drupal 11 site where there are already over 7000 published nodes.
There were two situations where I was seeing this behaviour:
First, when I enabled maxlength trimming on the description field (so I disabled maxlength trimming to continue testing what was going on), and again when I used a custom field as the description value (specifically, I created a config for a specific node type and used a field on that node as the description value, so the token was just [node:field_description).
In both cases, I wasn't able to view any nodes / nodes of that type after saving the metatag configuration.
At first I was just getting a 500 server error and a blank page in the browser, without any messages in dblog, but eventually I did get the 'infinite recursion ?' error on the node (not sure why - I reloaded the page a few times and ran cron a few times).
I applied the patch attached to this issue, but I'm still getting the 'Error: Maximum call stack size' error in the browser and can't view the nodes.
Comment #5
roberto.muzzano commentedHello.
Same error with Drupal 10.3.13, but also with Drupal 10.4.9.
The was applied correctly but seems to not work.
Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 20480 bytes) in /app/web/core/lib/Drupal/Core/Datetime/DateFormatter.php on line 114 Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 20480 bytes) in /app/web/core/lib/Drupal/Core/Session/SessionHandler.php on line 86 Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 20480 bytes) in /app/web/core/includes/errors.inc on line 26
Comment #6
damienmckenna@Roberto: What patch are you applying?
Comment #7
roberto.muzzano commentedHello @damienmckenna
This one https://www.drupal.org/files/issues/2025-08-08/fix_recursion.patch
Gathering patches for dependencies. This might take a minute.
- Installing drupal/metatag (2.2.0): Extracting archive
- Applying patches for drupal/metatag
https://www.drupal.org/files/issues/2025-08-08/fix_recursion.patch (Fix recursion (Drupal.org issue patch 2025-08-08))
Comment #8
roberto.muzzano commentedHello, what kind of informations you need to check and fix the problem?
I can provide a repository with the problem.
Comment #9
pemson18@damienmckenna This problem still persists here is the full error stack in the txt file attached, This happens on a webform save
Comment #10
roberto.muzzano commentedHello @damienmckenna.
At the moment, I am unable to update the module from version 1.x to 2. I have tried 2.0.x, 2.1.x, and 2.2.x, but nothing works. Also this patch https://www.drupal.org/files/issues/2025-08-08/fix_recursion.patch seems to not fix the problem.
It is the last module that needs to be updated to move to Drupal version 10.4. x, I have tried debugging to find the problem, but without success, partly because the module is quite large.
As mentioned, I can provide a repository that shows the problem and the related database. I imagine this could be useful for debugging.
If anyone could take a look, it would be greatly appreciated.
Comment #11
damienmckennaPlease reach out to me via my contact page and I'll see if I can get to the bottom of this.
Comment #12
pemson18Comment #13
pemson18Comment #14
pemson18https://www.drupal.org/project/metatag/issues/3484284
The patch https://www.drupal.org/files/issues/2025-10-22/out-of-memory-error-with-... fixes the issue