sfw/fix
Drupal WSOD high

Drupal "The website encountered an unexpected error. Please try again later."

Drupal's generic fatal-error page that hides the real PHP exception behind a deliberately vague message.

What you see

The website encountered an unexpected error. Please try again later.

What’s actually happening

A page that worked yesterday now shows this one-line message, or the whole site does. By design it tells you nothing — Drupal suppresses the actual error on production so visitors don't see stack traces. Sometimes you get a true white screen with no text at all (the classic WSOD). The cause is almost always sitting in the logs or behind the verbose error setting; the on-screen text is a dead end on its own.

Common causes

  • A module conflict or a fatal error inside a contrib/custom module — frequently right after an update or after enabling something new.
  • Stale or corrupt cache after a deployment or code change, so Drupal is running against cached class maps that no longer match the code.
  • PHP memory_limit exhausted while building a page or running cron, which surfaces as the same generic message.
  • A database update wasn't run after deploying new code (update.php / drush updb pending), leaving schema and code out of sync.
  • A PHP version mismatch or a missing PHP extension the module requires (e.g. a module needs PHP 8.1 but the server runs 7.4).

How to fix it

  1. Turn on verbose errors so you can see the real exceptionIn sites/default/settings.php set $config['system.logging']['error_level'] = 'verbose'; and reload the page. Drupal will now print the actual error, file, and line instead of the generic sentence. Revert to 'hide' when you're done.
  2. Read the logs directlyCheck the database log at Reports > Recent log messages (admin/reports/dblog) if the admin still loads, or drush watchdog:show. Also tail the PHP/Apache error log — for a true WSOD the fatal is in the web server log, not Drupal's.
  3. Clear the cacheRun drush cr (Drupal 8/9/10) or drush cc all (Drupal 7). After any code change or update, a stale cache is the single most common cause and the cheapest thing to rule out.
  4. Run pending database updatesIf you just deployed code, run drush updb (or visit /update.php). Mismatched schema vs code throws fatals that look exactly like this.
  5. Bisect modules if it followed a changeIf the error started after enabling or updating a module, disable it (drush pmu module_name) and retest. For a custom module, the verbose error from step 1 points straight at the offending file and line.

Stop it recurring

Run drush cr and drush updb as the last step of every deployment, and keep PHP memory_limit at 256M.

Related errors