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

Created on 11 February 2025, 12 days ago

Problem/Motivation

I am using Drupal CMS.

I built a site on a web server and used this module and everything worked well while I was building the site.

After I completed the site I deployed it on another web server and the site was badly broken with this error,

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

The frontend was broken, the admin pages was broken, Drush was badly broken that I couldn't run virtually any Drush command.

I went back on the first server and uninstalled this module and copied the database over and the site worked.

I then added the module back on the new server. After some days of extra work on the website I checked in admin/config/development/settings and noticed Do not cache markup was active and so I turned if off. As soon as I turned it off, this error returned on the site and completely locked it. I couldn't access admin pages, I couldn't access the frontpage, I couldn't run Drush commands. I tried disabling this module in the database and all manner of efforts, and I was not able to bring back the website to live. I had to finally restore the site to when I first deployed it without this module, thereby loosing days of work.

This is a badly critical error.

🐛 Bug report
Status

Active

Version

8.1

Component

Code

Created by

🇳🇬Nigeria chike Nigeria

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

Comments & Activities

Production build 0.71.5 2024