The "mailer_policy" entity type does not exist.

Created on 8 May 2023, over 1 year ago
Updated 15 May 2023, over 1 year ago

Problem/Motivation

WSOD after enabling on Drupal 10 with the following error message:

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "mailer_policy" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 139 of /home/public_html/core/lib/Drupal/Core/Entity/EntityTypeManager.php).

🐛 Bug report
Status

Fixed

Version

1.3

Component

Code

Created by

🇳🇬Nigeria chike Nigeria

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

Comments & Activities

  • Issue created by @chike
  • 🇬🇧United Kingdom adamps

    Thanks for the report. I haven't started using D10 yet so I can't confirm.

    Please can you add more details:

    1. What causes the bug? Do you see it on every page, or just sometimes?
    2. Please can you turn on backtrace to give the full stack trace?
  • 🇳🇬Nigeria chike Nigeria

    1. As soon I enable the module the error shows and site breaks.

    2. I got this stack trace,

    The website encountered an unexpected error. Please try again later.
    
    Drupal\Component\Plugin\Exception\PluginNotFoundException: The "mailer_policy" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 139 of core/lib/Drupal/Core/Entity/EntityTypeManager.php).
    Drupal\symfony_mailer\Processor\OverrideManager->__construct() (Line: 259)
    Drupal\Component\DependencyInjection\Container->createService() (Line: 177)
    Drupal\Component\DependencyInjection\Container->get() (Line: 187)
    Drupal::service() (Line: 54)
    symfony_mailer_mailer_builder_info_alter() (Line: 545)
    Drupal\Core\Extension\ModuleHandler->alter() (Line: 340)
    Drupal\Core\Plugin\DefaultPluginManager->alterDefinitions() (Line: 295)
    Drupal\Core\Plugin\DefaultPluginManager->findDefinitions() (Line: 205)
    Drupal\symfony_mailer\Processor\EmailBuilderManager->findDefinitions() (Line: 181)
    Drupal\Core\Plugin\DefaultPluginManager->getDefinitions() (Line: 218)
    Drupal\symfony_mailer\Processor\EmailBuilderManager->buildCache() (Line: 174)
    Drupal\symfony_mailer\Processor\EmailBuilderManager->loadOverrides() (Line: 209)
    Drupal\Core\Config\ConfigFactory->loadOverrides() (Line: 169)
    Drupal\Core\Config\ConfigFactory->doLoadMultiple() (Line: 104)
    Drupal\Core\Config\ConfigFactory->doGet() (Line: 89)
    Drupal\Core\Config\ConfigFactory->get() (Line: 108)
    Drupal\views\ViewsData->__construct() (Line: 259)
    Drupal\Component\DependencyInjection\Container->createService() (Line: 177)
    Drupal\Component\DependencyInjection\Container->get() (Line: 434)
    Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() (Line: 237)
    Drupal\Component\DependencyInjection\Container->createService() (Line: 177)
    Drupal\Component\DependencyInjection\Container->get() (Line: 434)
    Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() (Line: 273)
    Drupal\Component\DependencyInjection\Container->createService() (Line: 177)
    Drupal\Component\DependencyInjection\Container->get() (Line: 262)
    Drupal\Core\Extension\ModuleInstaller->install() (Line: 83)
    Drupal\Core\ProxyClass\Extension\ModuleInstaller->install() (Line: 502)
    Drupal\system\Form\ModulesListForm->submitForm()
    call_user_func_array() (Line: 114)
    Drupal\Core\Form\FormSubmitter->executeSubmitHandlers() (Line: 52)
    Drupal\Core\Form\FormSubmitter->doSubmitForm() (Line: 595)
    Drupal\Core\Form\FormBuilder->processForm() (Line: 323)
    Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
    Drupal\Core\Controller\FormController->getContentResult()
    call_user_func_array() (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 163)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 74)
    Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 681)
    Drupal\Core\DrupalKernel->handle() (Line: 19)
  • 🇬🇧United Kingdom adamps

    Thanks. It could be caused by 🐛 Circular reference on multi-language sites Fixed - maybe OverrideManager is calling EntityTypeManager->getDefinition() in the middle of trying to create EntityTypeManager.

  • 🇧🇪Belgium fbreckx Antwerp

    Same here!

  • 🇬🇧United Kingdom adamps

    🐛 Circular reference on multi-language sites Fixed has now been fixed in the latest dev. Please try it and see if it also fixes this problem.

  • 🇭🇷Croatia valic Osijek

    Removing loading overrides on the hook hook_mailer_builder_info_alter installs the module usually. (using latest dev with mentioned fixes for circular reference / multi-language site)
    Not sure what those overrides are used for, but this seems as close as possible to hit a circular reference

    Drupal starts to process hooks:
    - reaches symfony_mailer_mailer_builder_info_alter
    - that hook then has a call towards symfony_mailer.override_manager which represents \Drupal\symfony_mailer\Processor\OverrideManager
    - OverrideManager class is injecting \Drupal\symfony_mailer\Processor\EmailBuilderManager, which in fact, provides the hooks above to exist at all (any mailer_builder_info hook)

    Index: web/modules/contrib/symfony_mailer/symfony_mailer.module
    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
    ===================================================================
    diff --git a/web/modules/contrib/symfony_mailer/symfony_mailer.module b/web/modules/contrib/symfony_mailer/symfony_mailer.module
    --- a/web/modules/contrib/symfony_mailer/symfony_mailer.module	
    +++ b/web/modules/contrib/symfony_mailer/symfony_mailer.module	(date 1683935927432)
    @@ -50,14 +50,6 @@
      * Implements hook_mailer_builder_info_alter().
      */
     function symfony_mailer_mailer_builder_info_alter(array &$email_builders) {
    -  // Disable overrides based on configuration.
    -  $override_manager = \Drupal::service('symfony_mailer.override_manager');
    -  foreach ($email_builders as $id => $definition) {
    -    if ($definition['override'] && !$override_manager->isEnabled($id)) {
    -      unset($email_builders[$id]);
    -    }
    -  }
    -
       // Add EmailBuilder definitions for any implementations of hook_mail() that
       // don't already have one, using LegacyEmailBuilder.
       $module_handler = \Drupal::moduleHandler();
    
    
  • Status changed to Needs review over 1 year ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update over 1 year ago
    5 pass
  • 🇬🇧United Kingdom adamps

    This patch might fix it (but it is a guess as I don't see the bug anyway). Please can someone test?

    If you still see the problem with the latest dev release and the patch, please can you upload a new stack trace?

    Does anyone see this on D9 or is it D10 only?

  • 🇳🇬Nigeria chike Nigeria

    The patch on the latest dev release solved the issue.

  • 🇬🇧United Kingdom adamps

    The patch on the latest dev release solved the issue.

    Thanks for confirmation. Please can you clarify?

    1. Fixed by the dev release alone (including the patch for #3355846)
    2. Fixed by the dev release plus the patch here in #8
  • 🇳🇬Nigeria chike Nigeria

    I actually wanted to test this so I first tried the dev release alone and the issue wasn't solved then I applied patch #8 and the issue was solved.

    • AdamPS committed b5b5a19a on 1.x
      Issue #3358862 by AdamPS, chike: The "mailer_policy" entity type does...
  • Status changed to Fixed over 1 year ago
  • 🇬🇧United Kingdom adamps

    Thanks

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024