BaseFieldError: Call to undefined method Drupal\Core\Field\Definition::get() in _field_tokens()

Created on 15 January 2024, 11 months ago
Updated 19 January 2024, 11 months ago

Problem/Motivation

We noticed the following error in logs. Token version is 8.x-1.13 and Hook entity dispatcher is 4.0.0-rc1.

Error: Call to undefined method Drupal\Core\Field\BaseFieldDefinition::get() in _field_tokens() (line 1790 of /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/modules/contrib/token/token.tokens.inc) 

The error seems to happen during cron runs with Ultimate cron.

Here is the completely stacktrace

Error: Call to undefined method Drupal\Core\Field\BaseFieldDefinition::get() in _field_tokens() (line 1790 of /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/modules/contrib/token/token.tokens.inc)

#0 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/modules/contrib/token/token.tokens.inc(504): _field_tokens()
#1 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/modules/contrib/hook_event_dispatcher/src/HookEventDispatcherModuleHandler.php(52): token_tokens()
#2 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(388): Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler::Drupal\hook_event_dispatcher\{closure}()
#3 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/modules/contrib/hook_event_dispatcher/src/HookEventDispatcherModuleHandler.php(67): Drupal\Core\Extension\ModuleHandler->invokeAllWith()
#4 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/modules/contrib/hook_event_dispatcher/src/HookEventDispatcherModuleHandler.php(59): Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler->invokeAllWith()
#5 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/core/lib/Drupal/Core/Utility/Token.php(364): Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler->invokeAll()
#6 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/modules/contrib/token/token.tokens.inc(1095): Drupal\Core\Utility\Token->generate()
#7 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/modules/contrib/hook_event_dispatcher/src/HookEventDispatcherModuleHandler.php(52): token_tokens()
#8 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(388): Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler::Drupal\hook_event_dispatcher\{closure}()
#9 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/modules/contrib/hook_event_dispatcher/src/HookEventDispatcherModuleHandler.php(67): Drupal\Core\Extension\ModuleHandler->invokeAllWith()
#10 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/modules/contrib/hook_event_dispatcher/src/HookEventDispatcherModuleHandler.php(59): Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler->invokeAllWith()
#11 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/core/lib/Drupal/Core/Utility/Token.php(364): Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler->invokeAll()
#12 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/core/lib/Drupal/Core/Utility/Token.php(241): Drupal\Core\Utility\Token->generate()
#13 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/core/lib/Drupal/Core/Utility/Token.php(191): Drupal\Core\Utility\Token->doReplace()
#14 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/modules/contrib/token_or/src/Token.php(18): Drupal\Core\Utility\Token->replace()
#15 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/modules/contrib/pathauto/src/PathautoGenerator.php(239): Drupal\token_or\Token->replace()
#16 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/modules/contrib/pathauto/src/PathautoGenerator.php(519): Drupal\pathauto\PathautoGenerator->createEntityAlias()
#17 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/modules/contrib/pathauto/pathauto.module(93): Drupal\pathauto\PathautoGenerator->updateEntityAlias()
#18 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/modules/contrib/hook_event_dispatcher/src/HookEventDispatcherModuleHandler.php(52): pathauto_entity_update()
#19 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(388): Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler::Drupal\hook_event_dispatcher\{closure}()
#20 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/modules/contrib/hook_event_dispatcher/src/HookEventDispatcherModuleHandler.php(67): Drupal\Core\Extension\ModuleHandler->invokeAllWith()
#21 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/modules/contrib/hook_event_dispatcher/src/HookEventDispatcherModuleHandler.php(59): Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler->invokeAllWith()
#22 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(217): Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler->invokeAll()
#23 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(900): Drupal\Core\Entity\EntityStorageBase->invokeHook()
#24 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(564): Drupal\Core\Entity\ContentEntityStorageBase->invokeHook()
#25 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(781): Drupal\Core\Entity\EntityStorageBase->doPostSave()
#26 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(489): Drupal\Core\Entity\ContentEntityStorageBase->doPostSave()
#27 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(806): Drupal\Core\Entity\EntityStorageBase->save()
#28 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/core/modules/media/src/MediaStorage.php(29): Drupal\Core\Entity\Sql\SqlContentEntityStorage->save()
#29 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/core/lib/Drupal/Core/Entity/EntityBase.php(339): Drupal\media\MediaStorage->save()
#30 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/core/modules/media/src/Plugin/QueueWorker/ThumbnailDownloader.php(64): Drupal\Core\Entity\EntityBase->save()
#31 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/core/lib/Drupal/Core/Cron.php(268): Drupal\media\Plugin\QueueWorker\ThumbnailDownloader->processItem()
#32 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/core/lib/Drupal/Core/Cron.php(233): Drupal\Core\Cron->processQueue()
#33 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/modules/contrib/ultimate_cron/src/UltimateCron.php(69): Drupal\Core\Cron->processQueues()
#34 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/web/modules/contrib/ultimate_cron/src/ProxyClass/UltimateCron.php(70): Drupal\ultimate_cron\UltimateCron->run()
#35 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/vendor/drush/drush/src/Commands/core/DrupalCommands.php(63): Drupal\ultimate_cron\ProxyClass\UltimateCron->run()
#36 [internal function]: Drush\Commands\core\DrupalCommands->cron()
#37 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array()
#38 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback()
#39 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter()
#40 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(391): Consolidation\AnnotatedCommand\CommandProcessor->process()
#41 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()
#42 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/vendor/symfony/console/Application.php(1081): Symfony\Component\Console\Command\Command->run()
#43 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/vendor/symfony/console/Application.php(320): Symfony\Component\Console\Application->doRunCommand()
#44 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/vendor/symfony/console/Application.php(174): Symfony\Component\Console\Application->doRun()
#45 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run()
#46 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun()
#47 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run()
#48 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/vendor/drush/drush/drush(4): require('/var/www/html/b...')
#49 /var/www/html/builds/2024-01-12.09-23-59.commit--fafd87874/vendor/bin/drush(117): include('/var/www/html/b...')
#50 {main}


Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Closed: works as designed

Version

4.0

Component

Code

Created by

🇫🇮Finland heikkiy Oulu

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

Comments & Activities

  • Issue created by @heikkiy
  • 🇮🇳India samir_shukla bareilly

    Hi, I am unable to produce the error. I installed the modules and run all the crons. Do i have to run any particular cron?

  • 🇫🇮Finland heikkiy Oulu

    I checked our staging and we seem to be still getting this error during cron run. We will try to debug this a bit more to understood where this error is coming from.

    It might be that this issue should be moved to Token module issue queue because the error is coming from web/modules/contrib/token/token.tokens.inc.

  • Status changed to Closed: works as designed 11 months ago
  • 🇫🇮Finland heikkiy Oulu

    We debugged this more and it seems to be related to this Token patch we are using:

    "drupal/token": {
       "#3281871 Token generation of entity references are not respecting the given langcode": "https://www.drupal.org/files/issues/2023-11-09/3281871_token_entity_references_langcode.patch"
    },
    

    I will close this ticket and continue the discussion there.

Production build 0.71.5 2024