Score:0

$container not initialized after installation from sources (code and database)

cn flag

I'm working on a site installed with Composer. After the local installation broke, I'm trying to reinstall the project from source code and the MySQL database. All the sources are versioned on Git (including the /vendor folder).

After Acquia installation, all the pages return a 500 error. When I run drush ws to debug, I get the following error message.

Drupal\Core\DependencyInjection\ContainerNotInitializedException: \Drupal::$container is not initialized yet. \Drupal::setContainer() must be called with a real container. in C:\workspaces\dev\AltaD8\web\core\lib\Drupal.php on line 130
#0 C:\workspaces\dev\AltaD8\web\core\lib\Drupal.php(518): Drupal::getContainer()
#1 C:\Program Files (x86)\DevDesktop\tools\vendor\drush\drush\commands\core\drupal\environment.inc(141): Drupal::moduleHandler()
#2 C:\Program Files (x86)\DevDesktop\tools\vendor\drush\drush\lib\Drush\Boot\DrupalBoot.php(242): drush_module_exists('dblog')
#3 C:\Program Files (x86)\DevDesktop\tools\vendor\drush\drush\lib\Drush\Boot\DrupalBoot.php(73): Drush\Boot\DrupalBoot->drush_enforce_requirement_drupal_dependencies(Array)
#4 C:\Program Files (x86)\DevDesktop\tools\vendor\drush\drush\lib\Drush\Boot\BaseBoot.php(60): Drush\Boot\DrupalBoot->enforce_requirement(Array)
#5 C:\Program Files (x86)\DevDesktop\tools\vendor\drush\drush\includes\preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#6 C:\Program Files (x86)\DevDesktop\tools\vendor\drush\drush\drush.php(12): drush_main()
#7 {main} Drupal\Core\DependencyInjection\ContainerNotInitializedException: \Drupal::$container is not initialized yet. \Drupal::setContainer() must be called with a real container. in Drupal::getContainer() (line 130 of C:\workspaces\dev\AltaD8\web\core\lib\Drupal.php).
Drush command terminated abnormally due to an unrecoverable error.

Oddly, drush cr seems to work flawlessly.

How can I troubleshoot this? I don't know where to start.

cn flag
I suspect a custom module to be the source of this error, but i can't disable module as both admin and drush are not working. The issue is caused by importing the production database into other environments. It affect the dev server as well
in flag
Double check your settings.php and drushrc.php files.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.