Last updated 15 July 2016. Created on 24 May 2013.
Edited by saurabh.dhariwal, Cameron Tod,, Yashaswini.Trivedi. Log in to edit this page.

This error may have many causes:

Note: Don't change your site's settings.php or files within your site's sites/default/files/config_HASH/active directory.

1. Possible Simple Solutions

2. Your site's Dependency Injection Container (DIC) needs to be rebuilt.

First, try to run update.php ( in your browser (this is not a PHP file but a route to DbUpdateController).

If you still get this error try to remove the php directory in sites/default/files.

3. Your site's database caches may have been left in an unstable state or may be stale.

Clearing the {cache_*} tables may solve this issue. The best method for clearing caches if you are new to Drupal is to log in as an administrator and visit then click the button labeled Clear all caches.

With drush
If you can't access the admin tools to clear Drupal's cache the traditional way, try with drush, a command line tool for Drupal:
drush cr OR drush rebuild

In addition, To rebuild a Drupal 8 site and clear all its caches. You can use drush command: drush cache-rebuild

Please find more details from here.

4. Your site's database is not running or is not configured properly.

Verify that your database is running. If your database (Ex. MySQL) is not running, turn it on and then go back to your site's homepage.

5. Drupal is not installed properly.

This error occurs when your settings.php file is already populated but your database is empty. This usually occurs when you're trying to re-install, and can be caused by Drupal not having write permissions on settings.php.

There are two possible solutions to resolving this issue:

  1. Copying default.settings.php over settings.php.
  2. Allowing write permissions for the server user on settings.php

6. Your site's modules or libraries do not adhere to standard PHP coding practices.

This may be especially true if your module or library is missing required use statements, i.e., if your code files are missing necessary imports. Check whether you have included use statements for all of the PHP classes and interfaces in your code.

7. Opcode cache configuration

OPcache for example requires the following settings to work with Annotations:

php_admin_flag[opcache.load_comments] = on
php_admin_flag[opcache.save_comments] = on

8. Coding errors in a module (often a custom module)

This error can be triggered by a coding error, specifically if you have created a new module in the modules directory, activated it, and did something wrong. If you have the dblog module enabled, you may find a relevant error through looking at the most recent records in the watchdog table. Since this error prevents use of the Drupal front end, you'll need to use a database tool like phpMyAdmin or a command line utility. Sample query:

SELECT message, variables FROM watchdog WHERE type = 'php' ORDER BY timestamp DESC LIMIT 1;

Sample result:

| %type: !message in %function (line %line of %file). | a:5:{s:5:"%type";s:24:"BadFunctionCallException";s:8:"!message";s:120:"Theme hook "my_example" refers to a theme function callback that does not exist: "theme_mmy_example"" ... |

In this case, the error is a typo in the function name given in a hook_theme() implementation.

A message in the watchdog table like Recursive router rebuild detected. indicates an error in a x.routing.yml file. Remove (or rename) your routing.yml and reload your root page - the error is gone.

Also note:

A YAML file cannot contain tabs as indentation

If you have tabs in your routing.yml you'll get that error also.

9. Check for mistakes in theme yml files

You might have forgotten something as simple as a colon.
For example, in YOURTHEME.libraries.yml, when listing css, don't forget the colon behind the .css extension, like so:
css/main.css: {}

10. You forgot hash_salt in settings.php

Drupal requires a settings key called hash_salt to secure transient hashes.

It will be generated during Drupal install and added to settings.php. If you use a different settings.php in different environments (for example, a settings.local.php), you may have forgotten to set this variable.

Add a line to your local settings.php like:

$settings['hash_salt'] = 'whatever you like';

11. You have overwritten settings.php with example version

Since Github per default excludes the settings.php per default in the repository you may accidentally replace the version on server with environment version (eg. renaming example.settings.php in IDE such as PhpStorm). And therefore wiping out database settings and $settings['hash_salt'] = ' ' hash-string leaving your site in a non-functioning state.

Error in Drush
When using drush rebuild or drush rebuild-cache after correcting database settings you might get "exception 'RuntimeException' with message 'Missing $settings['hash_salt'] in settings.php.'".

Find hash_salt string
Check for a folder starting with config_ in sites/default/files. Voilá, there is the hash_salt string. Just add this inside the quotes of $settings['hash_salt'] = ' ' (without the prefix config_) and save.

PHP error on configurations pages

If you get the error visiting the admin configuration pages:
The website encountered an unexpected error. Please try again later.

And the following from your error.log file:
Uncaught PHP Exception Exception: "The configuration directory type 'sync' does not exist"

Simply add an sync folder in an appropriate place on your filesystem, and add a line to your settings.php like:

$config_directories['sync'] = __DIR__ . '/sync';

The above snippet is for use on a local development machine (for example, in settings.local.php).

You should only have to do this when moving a site from one host to another. Drupal will create appropriate directories during installation in your sites/default or sites/<sitename> folder.

Missing trusted host pattern
You'll probably get an error in Status Report saying your site is vulnerable.
You can find the example in settings.php or on this page.

$settings['trusted_host_patterns'] = array(

Tadaaa, it hopefully works. Better than re-installing and losing everything!


@TODO - more reasons here

Looking for support? Visit the forums, or join #drupal-support in IRC.


sootamee’s picture

I experienced this when accidentally MySQL Server is not running

rkarajgi’s picture

I saw this error when the database user's password was wrong and when the user's permissions were not set correctly on the database.

- R Karajgikar

awasson’s picture

I ran into this problem with a MySQL failure today. MySQL "silently" failed but I detected it on a reboot when I could see it failed to start at Boot. It was a matter of my Ubuntu server running out of available disk space. Clearing the cached package files via "sudo apt-get clean", allowed me to start the mysql server and my Drupal 8 Alpha 15 came back up.

aaronbauman’s picture

I have run into this when editing or creating various yml files.
Have to reinstall entire Drupal site if none of the above works.
Not fun.
Needs to be reported as a bug, if it has not already.
If UX / DX is really a priority, there needs to be a more user-friendly restoration / debug / diagnostic process instituted.

vaibhavjain’s picture

Yup, same problem and reinstalled the complete Drupal installation. Worked good then.

Vaibhav Jain

geerlingguy’s picture

A few other things to check:

  • Make sure you're not running an old version of PHP, like 5.3.x (in my case, on the default PHP installation on Ubuntu 12.04, PHP 5.3.10 wasn't able to cope with Drupal's requirements).
  • If you installed Drupal via drush site-install, you may need to change permissions of the auto-generated settings.php file to 744 instead of 444 to let Drupal finish doing whatever it needs to. See this comment for more info.

Personal site:

New Zeal’s picture

I found that if I created the settings.php file, as you do when you create a drupal website, then I get this error. After flailing round the web looking for an answer it occurred to me to delete my settings.php and after that drupal installed. The install script should really be more intelligent regarding readiness for install.

dman’s picture

One of the things that caused this for me was an exception "Missing $settings['hash_salt'] in settings.php." - which I guess was due to me upgrading a dev copy of d8 to the latest git without totally rebuilding. Core is still unstable.
I did try to start fixing it by hand but ran into more issues, so just nuked the database and started again.

jans9208’s picture

After install of Drupal beta and activating all of the Webservices modules this error was shown.

I fix this error by deleting the config folder in "sites/default/files/config_*/". I found out that there were two config folders in this directory. The newest was empty, probably created by Drupal. When deleting the newest folder the problem was solved

stuzog’s picture

Did a drush cache-rebuild on a working site and got the blank screen except for "If you have just changed code (for example deployed a new module or moved an existing one) read" error. Following the instructions above including truncation got the following error during reinstallation:

Doctrine\Common\Annotations\AnnotationException: [Syntax Error] Expected PlainValue, got ')' at position 614 in class Drupal\menu_link\Entity\MenuLink. in Doctrine\Common\Annotations\AnnotationException::syntaxError() (line 41 of /Users/stuart/Sites/drupal-8.x-dev/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php).

Total reinstallation required.

gnuschichten’s picture

I saw this error after changing the theme (Helios responsive html5 8.0-dev).
After switching back to Bartik 8.0-alpha13 the error was gone.

(Server running under php 5.5)

rpsu’s picture

Helios responsive theme was/is broken, some twig variables have not been updated along with latest core changes.

Perttu Ehn

RaulMuroc’s picture

The same happens with latest Omega 8.x-dev.

Drupal Association individual member

jwilson3’s picture

The same happened with the Bootstrap 3 base theme. However, the bootstrap_business theme does currently (partially) work with Drupal 8.

tz_earl’s picture

If you uninstall a module in D8 and get a RouteNotFoundException, there's a known bug documented at "RouteNotFoundException when a module (previously added to shortcuts) disabled".

This has happened to me even though I never explicitly added a shortcut.

Also see my blog posting about this particular issue at

AndrzejG’s picture

How to clear all cache (see point 2 in the instructions)?

kay_v’s picture

Thanks for pointing out the need, @AndrezejG. See the update to the docs. - Drupal training

platypusjones’s picture

Do you have Drush installed?

cd ~/path/to/mysite
drush cr (drush cache-rebuild will also work).

proxiss’s picture

I just unzipped beta2 in my running installation (cause it's an alpha with restricted access). Afterwards, my site was not showing up any more. update.php was not working and deleting sites/default/php was also useless.
Had to restore files and database from my nightly backups, now I stay on beta1 for a while.


yktdan’s picture

just did a complete install on top of a working (unmodified) beta1. There is no update.php module any more so the documentation needs fixing. I do see a rebuild.php but it doesn't help.

Walt Daniels

yktdan’s picture

Fatal error: Call to a member function getPath() on a non-object in /home/nynjtcs/public_html/ on line 163

running it.

Walt Daniels

onxze’s picture

I ran in to same problem, but found out that classy needs to be enabled. After that all works.

RStrydom’s picture

I tried installing 8.0.0-beta3 on a local WAMP server.

First received the following:

Symfony\Component\Routing\Exception\RouteNotFoundException: Route "<front>" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 149 of C:\wamp\www\drupal8\core\lib\Drupal\Core\Routing\RouteProvider.php).

Then after trying to go to a different path like upgrade.php I received the error mentioned here.

Followed the steps and only succeeded when I replaced the settings.php.

Tried installing again and got the following:

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "user" entity type does not exist. in Drupal\Core\Entity\EntityManager->getDefinition() (line 256 of C:\wamp\www\drupal8\core\lib\Drupal\Core\Entity\EntityManager.php).

In both cases watchdog did not provide any information.
A database tables drop and replacing all files resulted in a successful installation.

Please Note: I did go to great lengths to try and find the reason why it failed, I just thought I should mention what I experienced.

bmagistro’s picture

Another cause that I have seen is selinux. Scenario: If a server is rebooted or selinux enfocement mode is changed to "enforcing" and contexts aren't properly configured you may also get this message. In production I would recommend correcting the context. In a development environment, you can get away with disabling selinux...not recommended (ever).

alexus’s picture

I updated my Drupal-8 instance to latest beta and now I'm getting following message:

If you have just changed code (for example deployed a new module or moved an existing one) read

I tried to follow some of these steps, but hitting road block(

  • cannot do step #1 - I guess 'cause I'm using latest beta
  • cannot do step #2 - I cannot login to /admin, nor cannot get latest drush to do "drush cr"

or maybe I'm doing something entirely wrong... after installing "drupal-8.0.0-beta6" I then copy my drupal/sites from -beta3 to -beta6 and start getting that message...

please advise.

jhdrop’s picture

After finished the documentation, i see the same error.

I clear cache with drush cr, but i have this error 'The container_yamls setting is missing from settings.php '

i not understand, someone help me.

derheap’s picture

There have been changes to default.settings.php in betra 6.
Look at your settings.php and the new default.settings.php and copy the missing pices.

hugronaphor’s picture

In my case it was missing:
$settings['container_yamls'][] = __DIR__ . '/services.yml';

tebb’s picture

This page is marked as 'Beginner Level', but the first bullet point is:

"1. Your site's Dependency Injection Container (DIC) needs to be rebuilt"

While helpful to some, I think that would scare/confuse most beginners, so could we filter out simpler issues before getting too technical?

I have started a 'Possible Simple Solutions' un-ordered list, with the issue that brought me to this page:

While cloning several sites in Acquia Dev Desktop, I accidentally access a Drupal 8, Beta 7 site root before running /core/install.php.

4aficiona2’s picture

When I moved my site from pantheon, which I set up on pantheon initially, I ran into problems after exchanging the settings files from pantheon with them from (8.0.2) - in my case.

I got the following error:
Exception: The configuration directory type 'sync' does not exist in config_get_config_directory() (line 154 of core/includes/

So I added

$config_directories = array(
  CONFIG_SYNC_DIRECTORY => 'sites/default/config',

to my settings.local.php which made my site run again.