\Drupal::$container is not initialized yet. \Drupal::setContainer() must be called with a real container. in Drupal::getContainer()

Created on 9 April 2025, about 2 months ago

Problem

When installing version 2.0.0 on Drupal 11.1.6 using PHP 8.3.19, I get the following error:

Drupal\Core\DependencyInjection\ContainerNotInitializedException: \Drupal::$container is not initialized yet. \Drupal::setContainer() must be called with a real container. in Drupal::getContainer() (line 169 of core/lib/Drupal.php).
Drupal::getContainer() (Line: 543)
Drupal::moduleHandler() (Line: 10)
include_once() (Line: 184)
Drupal\Core\Hook\HookCollectorPass->collectModuleHookImplementations() (Line: 147)
Drupal\Core\Hook\HookCollectorPass::collectAllHookImplementations() (Line: 78)
Drupal\Core\Hook\HookCollectorPass->process() (Line: 73)
Symfony\Component\DependencyInjection\Compiler\Compiler->compile() (Line: 814)
Symfony\Component\DependencyInjection\ContainerBuilder->compile() (Line: 1381)
Drupal\Core\DrupalKernel->compileContainer() (Line: 900)
Drupal\Core\DrupalKernel->initializeContainer() (Line: 505)
Drupal\Core\DrupalKernel->boot() (Line: 707)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Steps to reproduce

Install the module.

The issue didn't appear instantly. I managed to configure a view using this, and then it broke.

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΈπŸ‡ͺSweden persand Stockholm

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

Comments & Activities

Production build 0.71.5 2024