Drupal twig debug not working? Fix missing template hints fast with proven methods, exact config files, and commands that actually work. Our 24/7 Drupal Live Support Team is always here to help you.


If drupal twig debug not working has pushed you into endless cache clears and guesswork, you’re not alone. Twig debugging should be simple. Yet for many Drupal developers, template hints refuse to show up, dump() does nothing, and comments never appear in the markup.

The good news? This problem usually comes down to one missing file, one ignored config, or one wrong assumption. Let’s fix it properly, step by step, without touching core or risking production.

drupal twig debug not working

Why Drupal Twig Debug Usually Fails

Before jumping into fixes, here’s what actually happens behind the scenes.

Drupal does not automatically load development services. Even if your YAML file is perfect, Drupal will silently ignore it unless you explicitly tell it to load.

So when people say “I enabled twig debug but nothing changed”, the real issue is this:

Drupal never read your config file

That’s why drupal twig debug not working shows up so often in search.

The Correct and Safe Way (Recommended)

This method works on Drupal 8, 9, and 10. It’s clean, reversible, and production-safe.

Add this to settings.php

Make sure this block is at the very bottom of /sites/default/settings.php:

/**
* Load local development override configuration, if available.
*/
if (file_exists(__DIR__ . '/settings.local.php')) {
include __DIR__ . '/settings.local.php';
}

This ensures dev settings never leak into production.

Create settings.local.php (Not in Git)

Inside /sites/default/settings.local.php:

$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';

This single line is the most missed step when drupal twig debug not working.

Enable Twig Debug in development.services.yml

Create or update /sites/development.services.yml:

parameters:
http.response.debug_cacheability_headers: true
twig.config:
debug: true
auto_reload: true
cache: false
services:
cache.backend.null:
class: Drupal\Core\Cache\NullBackendFactory

This enables:

  • Template name hints
  • dump() in Twig
  • Auto reload on file changes
Clear Cache (Don’t Skip This)

Run:

drush cr

Or clear cache from the admin UI.

Now view page source. You should see comments like:

<!-- THEME DEBUG -->
<!-- THEME HOOK: 'page' -->

If you don’t, drupal twig debug not working still means Drupal isn’t reading your file.

Stop guessing. Fix Twig debugging today.

Chat animation


What NOT to Do

Let’s be clear:

❌ Don’t edit core/core.services.yml
❌ Don’t rename development.services.yml to services.yml in production
❌ Don’t commit dev configs to Git
❌ Don’t assume cache clear alone fixes it

Yes, changing core files can work. But it’s fragile, unsafe, and will break on updates.

Quick Test: Is Drupal Reading Your File?

Add bad YAML temporarily:

twig.config
debug: true

Then clear cache.

If Drupal throws an error → file is loaded
If nothing happens → wrong file or wrong path

This test alone solves half the drupal twig debug not working cases.

Conclusion

When drupal twig debug not working, the fix isn’t magic. It’s discipline. Load the right file. Keep dev settings local. Clear cache once. That’s it.