I keep getting A wsod with the above error printed.

It is intermittent.

I modified the code to print the hook that is being executed when the exception gets thrown.

I get this:
Exception thrown and $hook = dblog_message
Exception thrown and $hook = username

Is there a way for me to have this be just a regular drupal erorr and not something that completely stops my site.
How do I get rid of it once it happens?

Issue fork drupal-1422876

Command icon 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

    socialnicheguru’s picture

    This time I get it on this page:
    admin/config/development/performance

    liam morland’s picture

    I am getting this when I try to use simpletest in D8:

    An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: .../drupal/batch?id=29&op=do StatusText: Service unavailable (with message) ResponseText: Exception: theme() may not be called until all modules are loaded. in theme() (line 964 of .../drupal/core/includes/theme.inc).

    kbasarab’s picture

    I get this same error as well. Mostly when trying to run simpletests on D8 against Bootstrap or Batch API.

    liam morland’s picture

    Version: 7.10 » 8.x-dev
    dsteplight’s picture

    Just a head's up for anyone who ran into this error message by changing a module. Make sure you don't break some array code by using a semi-colon instead of a comma at the end of your last array value e.g

    array(
    "foo" => "foo data",
    "bar" => "bar data";
    );

    Make sure your last element looks like

    "bar" => "bar data",

    I'm using Version 7.16

    Dharmendra.s’s picture

    Issue summary: View changes

    if you did't get any solution then goto the theme.inc file and comment this line
    //throw new Exception(t('theme() may not be called until all modules are loaded.'));
    now it's working fine...

    Baroch Oren’s picture

    This also crashes the CiviCRM mail-send cronjob.
    (Drupal 7.30; CiviCRM 4.2)
    I get:

    Exception: theme() may not be called until all modules are loaded. in theme() 
    (line 1017 of /home/xxx/public_html/includes/theme.inc).
    

    and after trying #6, I still get

    PHP Fatal error:  Call to undefined function _system_default_theme_features() in 
    /home/xxx/public_html/includes/theme.inc on line 1423
    avpaderno’s picture

    Category: Bug report » Support request
    Status: Active » Fixed

    This queue is not for support requests. Please open a support request in the appropriate forum.

    socialnicheguru’s picture

    Status: Fixed » Active

    has it been fixed?
    This was more than a support request.
    I filed it as a bug/feature request against Drupal 7.

    If there is an issue does an exception need to be thrown or can it just be an error:

    //throw new Exception(t('theme() may not be called until all modules are loaded.'));

    avpaderno’s picture

    Status: Active » Fixed

    Is there a way for me to have this be just a regular drupal erorr and not something that completely stops my site.
    How do I get rid of it once it happens?

    Ask in the forums for support.

    To file a bug report, you first need to check you can reproduce it on a fresh installation, and report what you were doing when getting the error message. I did it, and I cannot reproduce this bug. I doubt it's a Drupal core bug, since Drupal doesn't call theme() when its bootstrap phase is not completed.

      // If called before all modules are loaded, we do not necessarily have a full
      // theme registry to work with, and therefore cannot process the theme
      // request properly. See also _theme_load_registry().
      if (!module_load_all(NULL) && !defined('MAINTENANCE_MODE')) {
        throw new Exception(t('theme() may not be called until all modules are loaded.'));
      }
    

    Check also your site is not in maintenance mode.

    Status: Fixed » Closed (fixed)

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