Problem/Motivation

On initial site URL view and even after credentials submission and validation the following error is logged three times.

Drupal: 11.1
Shield:

TypeError: Drupal\Core\Entity\EntityTypeManager::Drupal\Core\Entity\{closure}(): Argument #1 ($hook) must be of type callable, string given, called in /var/www/html/docroot/core/lib/Drupal/Core/Extension/ModuleHandler.php on line 307 in Drupal\Core\Entity\EntityTypeManager->Drupal\Core\Entity\{closure}() (line 117 of /var/www/html/docroot/core/lib/Drupal/Core/Entity/EntityTypeManager.php)
#0 /var/www/html/docroot/core/lib/Drupal/Core/Extension/ModuleHandler.php(307): Drupal\Core\Entity\EntityTypeManager->Drupal\Core\Entity\{closure}()
#1 /var/www/html/docroot/core/lib/Drupal/Core/Entity/EntityTypeManager.php(117): Drupal\Core\Extension\ModuleHandler->invokeAllWith()
#2 /var/www/html/docroot/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php(213): Drupal\Core\Entity\EntityTypeManager->findDefinitions()
#3 /var/www/html/docroot/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryCachedTrait.php(22): Drupal\Core\Plugin\DefaultPluginManager->getDefinitions()
#4 /var/www/html/docroot/core/lib/Drupal/Core/Entity/EntityTypeManager.php(132): Drupal\Core\Plugin\DefaultPluginManager->getDefinition()
#5 /var/www/html/docroot/core/lib/Drupal/Core/Entity/EntityTypeManager.php(257): Drupal\Core\Entity\EntityTypeManager->getDefinition()
#6 /var/www/html/docroot/core/lib/Drupal/Core/Entity/EntityTypeManager.php(192): Drupal\Core\Entity\EntityTypeManager->getHandler()
#7 /var/www/html/docroot/core/modules/user/src/UserAuthentication.php(64): Drupal\Core\Entity\EntityTypeManager->getStorage()
#8 /var/www/html/docroot/core/modules/basic_auth/src/Authentication/Provider/BasicAuth.php(99): Drupal\user\UserAuthentication->lookupAccount()
#9 /var/www/html/docroot/modules/contrib/shield/src/ShieldMiddleware.php(336): Drupal\basic_auth\Authentication\Provider\BasicAuth->authenticate()
#10 /var/www/html/docroot/modules/contrib/shield/src/ShieldMiddleware.php(256): Drupal\shield\ShieldMiddleware->basicAuthRequestAuthenticate()
#11 /var/www/html/docroot/modules/contrib/shield/src/ShieldMiddleware.php(219): Drupal\shield\ShieldMiddleware->bypass()
#12 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\shield\ShieldMiddleware->handle()
#13 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#14 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#15 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#16 /var/www/html/docroot/core/lib/Drupal/Core/DrupalKernel.php(709): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#17 /var/www/html/docroot/index.php(19): Drupal\Core\DrupalKernel->handle()
#18 {main}

While the module features do function, errors are still logged. But only on the first request to the domain where the login prompt is enabled.

Comments

emptyvoid created an issue. See original summary.

emptyvoid’s picture

Title: On View TypeError: Drupal\Core\Entity\EntityTypeManager » Drupal 11 WHITE SCREEN OF DEATH -- On View TypeError: Drupal\Core\Entity\EntityTypeManager
Issue tags: +Drupal 11 compatibility, +white screen, +White Screen of Death, +failure
emptyvoid’s picture

When this scenario occurs (which is now verfied 100% by 10 different users) the system corrupts the Drupal registry and no site visitor can view the site.

The only solution requires manually logging into the target HTTP server and issuing a drush cr to rebuilt the cache and Drupal registry.
Every new user which authenticates to view the site, immediately corrupts and registry and cache for all active users.

This is a black flag bug.

liam morland’s picture

Are you able to add a test that demonstrates this? That would help to get it solved and prevent a regression.

pingwin4eg’s picture

I have a similar issue

TypeError: Drupal\Core\Entity\EntityFieldManager::{closure:Drupal\Core\Entity\EntityFieldManager::buildBaseFieldDefinitions():289}(): Argument #1 ($hook) must be of type callable, string given, called in web/core/lib/Drupal/Core/Extension/ModuleHandler.php on line 307

but right after the cache rebuilding. And I don't use the shield module, this issue is the only similar one appearing in google results. So I think the issue can be in Drupal core actually.

Drupal 11.1.6, PHP 8.4.5.

pingwin4eg’s picture

Looks like a hook is trying to be invoked, but the module, which implements it, is not loaded.

vbouchet’s picture

ram4nd’s picture

In 11.2.x I get "white screen of death", with this error:

TypeError: Drupal\shield\ShieldMiddleware::__construct(): Argument #2 ($config_factory) must be of type Drupal\Core\Config\ConfigFactoryInterface, Symfony\Component\HttpKernel\HttpKernel given, called in /var/www/html/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 in Drupal\shield\ShieldMiddleware->__construct() (line 110 of modules/contrib/shield/src/ShieldMiddleware.php).
Drupal\shield\ShieldMiddleware->__construct() (Line: 259)
Drupal\Component\DependencyInjection\Container->createService() (Line: 177)
Drupal\Component\DependencyInjection\Container->get() (Line: 430)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() (Line: 237)
Drupal\Component\DependencyInjection\Container->createService() (Line: 177)
Drupal\Component\DependencyInjection\Container->get() (Line: 430)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() (Line: 237)
Drupal\Component\DependencyInjection\Container->createService() (Line: 177)
Drupal\Component\DependencyInjection\Container->get() (Line: 430)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() (Line: 237)
Drupal\Component\DependencyInjection\Container->createService() (Line: 177)
Drupal\Component\DependencyInjection\Container->get() (Line: 430)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() (Line: 237)
Drupal\Component\DependencyInjection\Container->createService() (Line: 177)
Drupal\Component\DependencyInjection\Container->get() (Line: 1467)
Drupal\Core\DrupalKernel->getHttpKernel() (Line: 715)
Drupal\Core\DrupalKernel->handle() (Line: 19)
pingwin4eg’s picture

@ram4nd That is a totally different error. This issue is about ($hook) must be of type callable, your error is ($config_factory) must be of type Drupal\Core\Config\ConfigFactoryInterface.