Code and cache mismatches

Last updated on
4 October 2026

One problem regularly breaks a Drupal site straight after a deploy, and it is hard to see from the error alone: cached hook implementations the code does not have. The Code and cache mismatches check finds it. It is a report only.

Where to find it

Reports » Drupal Cleanup » Code and cache mismatches (/admin/reports/drupal-cleanup/code-cache), also summarized on the Status report.

Hook implementations the code does not have

Drupal saves the list of hook implementations when caches are rebuilt. If that rebuild ran against a different copy of the code (two copies of a site sharing one database, or files rolled back without a cache rebuild), the saved list can name functions or classes that this copy doesn't have, and every page that uses the hook fails.

drush cleanup:code-cache
drush cleanup:code-cache --rebuild

The first lists them. --rebuild rebuilds all caches from the copy of the code you run it in, then checks again. Run it from the copy the web server really serves. It exits with an error code while anything is missing, so deploy scripts can stop on it. Drush itself usually keeps working while pages fail, which is why this is a Drush command first.

Help improve this page

Page status: No known problems

You can: