(NB: this post refers to Drupal 8)
You may see an error like this if you’re developing a theme with caching disabled and twig.config.auto_reload on, and you’ve just removed a template from a subtheme:
Twig_Error_Loader: Template “themes/custom/test/templates/field–node–title.html.twig” is not defined (Drupal\Core\Template\Loader\ThemeRegistryLoader: Unable to find template “themes/custom/test/templates/field–node–title.html.twig” in the Drupal theme registry.)
To get rid of this you need to clear the theme-registry , until you do that it won’t correctly fall back to the equivalent file in your base theme.
Similarly, if you add if you add an extra template to a subtheme, Drupal will ignore it and continue to use the base theme until the theme-registry is cleared. (You won’t get an error, but you’ll wonder why your changes haven’t been reflected.)
To reset it:
drush cc theme-registry
or:
drush cr
The latter is less precise and takes longer to run, but is quicker to type the first time. Or you can use drush cc
and pick the number the menu.
Note this happens (for me) regardless of whether twig.config.cache is true/false or whether the dynamic page cache is disabled.