Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
When Drupal is set to maintenance mode, the following fatal error occurs:
TypeError: Argument 1 passed to Drupal\Core\Extension\ThemeHandler::addTheme() must be an instance of Drupal\Core\Extension\Extension, null given
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#8 | drupal-maintenance-page-addtheme-error-3218085-6.patch | 1.13 KB | fathima.asmat |
Issue fork drupal-3218085
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
fathima.asmat CreditAttribution: fathima.asmat at Soapbox Communications Ltd commentedThis patch should fix it.
Comment #3
fathima.asmat CreditAttribution: fathima.asmat at Soapbox Communications Ltd commentedComment #5
fathima.asmat CreditAttribution: fathima.asmat at Soapbox Communications Ltd commentedComment #6
cilefen CreditAttribution: cilefen as a volunteer commentedAs far as I know this doesn't actually happen normally. How do we reproduce this one?
Comment #7
fathima.asmat CreditAttribution: fathima.asmat at Soapbox Communications Ltd commentedComment #8
fathima.asmat CreditAttribution: fathima.asmat at Soapbox Communications Ltd commentedComment #10
Kristen Pol@fathima.asmat Would you provide more detailed steps to reproduce along with more information such as the Drupal version and any contributed modules you have installed. I agree with #6 that this is not a typical error so there may be something about your setup that is causing this.
Comment #11
x775 CreditAttribution: x775 commentedI encountered this obscure problem, too.
The issue arose attempting to upgrade a website from Drupal 8.8 to 9.3. Due to a number of other issues, the website was in maintenance mode when the upgrade was attempted. Subsequent database upgrades and module updates were carried out using drush. Attempting to access the website directly throws the following:
However, by forcing the website to leave maintenance mode by executing
drush sset system.maintenance_mode 0
I get another error, indicating that the base theme of customised theme is missing. In any event, applying the patch allows me to skip directly to the error concerning the customised theme.
Comment #12
cilefen CreditAttribution: cilefen as a volunteer commentedWhat is the value of
$settings['maintenance_theme']
insettings.php
?This error indicates there is a maintenance theme set with an undefined ancestor (base) theme.
Comment #14
dmezquiaI have the same error, but patch #8 doesn't work for me. Drupal 9.4.8.
Comment #16
nofue CreditAttribution: nofue as a volunteer commented@cilefen is right with #12: watch that setting before patching stuff.