Uninstalling causes WSOD & TypeError call_user_func() Argument must be a valid callback, function "field_default_token_default_value_callback" not found.

Created on 18 January 2023, over 1 year ago
Updated 21 April 2024, about 2 months ago

Uninstalling Field Default Token via Drush pm:uninstall or via admin/extend uninstall UI will resolve in WSOD with the following Error message on screen. Sooner ... or later.

TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, function "field_default_token_default_value_callback" not found or invalid function name in call_user_func() (line 400 of /web/core/lib/Drupal/Core/Field/FieldConfigBase.php)

Additional problem is that this error occurs not in every case immediately after uninstalling, maybe because of caching is active or other reasons. And the web administrator will be surprised about this White Screen Error maybe days later on particular parts of the site where the functionality of this module was involved before.

It seems that uninstalling the module leaves function calls in the database or in configs, what, for me, looks like a not properly coded uninstalling process. But I am not deep enough into this project and installed it just for testing.

The full Error message from the logs is:

TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, function "field_default_token_default_value_callback" not found or invalid function name in call_user_func() (line 400 of /web/core/lib/Drupal/Core/Field/FieldConfigBase.php)

#0 /web/core/lib/Drupal/Core/Field/FieldConfigBase.php(400): call_user_func()
#1 /web/modules/contrib/viewfield/src/Plugin/Field/FieldFormatter/ViewfieldFormatterDefault.php(116): Drupal\Core\Field\FieldConfigBase->getDefaultValue()
#2 /web/core/lib/Drupal/Core/Field/FormatterBase.php(89): Drupal\viewfield\Plugin\Field\FieldFormatter\ViewfieldFormatterDefault->viewElements()
#3 /web/modules/contrib/viewfield/src/Plugin/Field/FieldFormatter/ViewfieldFormatterDefault.php(95): Drupal\Core\Field\FormatterBase->view()
#4 /web/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php(265): Drupal\viewfield\Plugin\Field\FieldFormatter\ViewfieldFormatterDefault->view()
#5 /web/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php(266): Drupal\Core\Entity\Entity\EntityViewDisplay->buildMultiple()
#6 /web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(340): Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay->buildMultiple()
#7 /web/core/modules/node/src/NodeViewBuilder.php(24): Drupal\Core\Entity\EntityViewBuilder->buildComponents()
#8 /web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(282): Drupal\node\NodeViewBuilder->buildComponents()
#9 /web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(239): Drupal\Core\Entity\EntityViewBuilder->buildMultiple()
#10 [internal function]: Drupal\Core\Entity\EntityViewBuilder->build()
#11 /web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(101): call_user_func_array()
#12 /web/core/lib/Drupal/Core/Render/Renderer.php(788): Drupal\Core\Render\Renderer->doTrustedCallback()
#13 /web/core/lib/Drupal/Core/Render/Renderer.php(374): Drupal\Core\Render\Renderer->doCallback()
#14 /web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender()
#15 /web/core/lib/Drupal/Core/Template/TwigExtension.php(479): Drupal\Core\Render\Renderer->render()
#16 /web/sites/default/files/php/twig/xxxxxxxxxxxxx_block.html.twig_xxxxxxxxxxxxxxxxxxxxxxxxxxx.php(80): Drupal\Core\Template\TwigExtension->escapeFilter()
#17 /vendor/twig/twig/src/Template.php(182): __TwigTemplate_21737e91eb318a9cc0edc14b7967a238->block_content()
#18 /web/sites/default/files/php/twig/xxxxxxxxxxxxx_block.html.twig_xxxxxxxxxxxxxxxxxxxxxxxxxxx.php(68): Twig\Template->displayBlock()
#19 /vendor/twig/twig/src/Template.php(405): __TwigTemplate_xxxxxxxxxxxxxxxxxxxxxxxx->doDisplay()
#20 /vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling()
#21 /vendor/twig/twig/src/Template.php(390): Twig\Template->display()
#22 /web/core/themes/engines/twig/twig.engine(55): Twig\Template->render()
#23 /web/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template()
#24 /web/core/lib/Drupal/Core/Render/Renderer.php(433): Drupal\Core\Theme\ThemeManager->render()
#25 /web/core/lib/Drupal/Core/Render/Renderer.php(446): Drupal\Core\Render\Renderer->doRender()
#26 /web/core/lib/Drupal/Core/Render/Renderer.php(446): Drupal\Core\Render\Renderer->doRender()
#27 /web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender()
#28 /web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(242): Drupal\Core\Render\Renderer->render()
#29 /web/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
#30 /web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(243): Drupal\Core\Render\Renderer->executeInRenderContext()
#31 /web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(132): Drupal\Core\Render\MainContent\HtmlRenderer->prepare()
#32 /web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse()
#33 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
#34 /web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func()
#35 /vendor/symfony/http-kernel/HttpKernel.php(174): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#36 /vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#37 /web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
#38 /web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#39 /web/core/modules/page_cache/src/StackMiddleware/PageCache.php(191): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#40 /web/core/modules/page_cache/src/StackMiddleware/PageCache.php(128): Drupal\page_cache\StackMiddleware\PageCache->fetch()
#41 /web/core/modules/page_cache/src/StackMiddleware/PageCache.php(82): Drupal\page_cache\StackMiddleware\PageCache->lookup()
#42 /vendor/asm89/stack-cors/src/Asm89/Stack/Cors.php(49): Drupal\page_cache\StackMiddleware\PageCache->handle()
#43 /web/modules/contrib/advban/src/AdvbanMiddleware.php(57): Asm89\Stack\Cors->handle()
#44 /web/core/modules/ban/src/BanMiddleware.php(50): Drupal\advban\AdvbanMiddleware->handle()
#45 /web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle()
#46 /web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#47 /web/modules/contrib/remove_http_headers/src/StackMiddleware/RemoveHttpHeadersMiddleware.php(49): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#48 /vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\remove_http_headers\StackMiddleware\RemoveHttpHeadersMiddleware->handle()
#49 /web/core/lib/Drupal/Core/DrupalKernel.php(713): Stack\StackedHttpKernel->handle()
#50 /web/index.php(19): Drupal\Core\DrupalKernel->handle()
#51 {main}

It only came into my focus after a drush cache clear and cron run and the Error popping up in terminal just twice.

From my point of view regarding discussed/documented issue flags this is a "Major" if not "Critical" issue, rendering parts of the front side completely broken without warning and without any chance to quickly repair this. These calls are spread over the whole site in many places where fields got settings setup from this module.

As this project is still in dev status for Drupal 8 and higher and should not be used on non testing environments, I leave it by "Major" at first. But I strongly recommend not to install this project if you are not 100% sure about what you are doing and testing and not before backing up completely. It's not just removing config files and clearing caches.

Possible next steps to do to make this issue less harmful and to solve the underlying problem.

I tend to recommend steps in order from the quickest to the hardest/longest tasks for issues like that. Especially on dev projects to make the project usable/testable again as fast as possible.

So first thing I would do is to put a warning on the project page (maintainers?) here on Drupal linking to this issue and stating that this module cannot be uninstalled properly at the moment until this issue is solved in D8 and higher.

Second thing is to maybe rethink about how to build proper uninstall routines for this project or maybe even consider another approach to provide the functionality of the project instead of as it is now. For me it seems a little bit clunky to have calls to undefined functions left when a module has been uninstalled. But this is something maintainers and users should discuss together before starting any wasting work on patches.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇩🇪Germany diqidoq Berlin | Hamburg | New York | London | Paris

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024