When I try to edit a page to upload 2 documents, I get an error.

Procedure: I edit the node, upload the first document. Then I insert a new field to upload the second document. However, the second field does not appear and I get the following error message in dblog:

"Twig\Error\LoaderError: Template "themes/bootstrap_sbv/layout/sbv-personenseite-layout.html.twig" is not defined. in Twig\Loader\ChainLoader->getCacheKey() (line 10 of webpath/docroot/modules/ds/templates/ds-entity-view.html.twig).

I have tried to include the layout in the "ds-entity-view.html.twig" file.

{% include "/themes/bootstrap_sbv/layouts/sbv-personenseite-layout.html.twig" %}

But it doesn't work.

Curiously, everything works on the local environment. Only on the test and production environment I get the error. I have a custom theme on my Drupalsite.

  • Can you ensure that your template is present in the right location for non-working environments?
    – d70rr3s
    Commented Jan 23, 2020 at 10:43
  • Not sure if it makes any difference, but instead of using an absolute path {% include '/theme/my_theme/dummy...' %} you can use a module's or theme's machine name as namespace {% include '@my_theme/dummy...' %} - this way you are safe if your modules/themes are split in .../contrib/... (from drupal.org) and .../custom/... (own code) sub-folders
    – Hudri
    Commented Jan 23, 2020 at 11:11
  • I tried to add {% include "@bootstrap_sbv/layouts/sbv-personenseite-layout.html.twig" %} but get the following error Twig\Error\LoaderError: Template "@bootstrap_sbv/layouts/sbv-detail-page-layout.html.twig" is not defined in "modules/ds/templates/ds-entity-view.html.twig" at line 1. in Twig\Loader\ChainLoader->getCacheKey() (line 142 of /webpath/docroot/vendor/twig/twig/src/Loader/ChainLoader.php).
    – Zeroplexer
    Commented Jan 23, 2020 at 13:01
  • @Zeroplexer after giving it a thought I notice that the error cames from DS module. It seems to me that is possible that you are using custom layouts and you have a typo on the template route for that layout. Check this drupal.stackexchange.com/questions/162482/…
    – d70rr3s
    Commented Jan 23, 2020 at 14:20
  • 2
    Note that all Twig templates should always reside inside the /templates subfolder of your theme/module.
    – Hudri
    Commented Jan 23, 2020 at 14:53

3 Answers 3


Moving the templates to the Templates folder themes/THEMENAME/templates has solved the problem. I also had to change the path in the THEMENAME.layouts.yml

  • Please check your answer as "correct answer" so can be useful to others.
    – d70rr3s
    Commented Jan 23, 2020 at 15:22

Pay attention to @my_theme syntax it refers to themes/my_theme/templates folder while the desired template is located into themes/my_theme/layouts folder.

So what I suggest is to use a relative path to include the template, something like that:

{% include '../../../themes/bootstrap_sbv/layouts/sbv-personenseite-layout.html.twig' %}

  • Unfortunately it didn't work I get this error: Twig\Error\LoaderError: Template "@bootstrap_sbv/layouts/sbv-detail-page-layout.html.twig" is not defined in "modules/ds/templates/ds-entity-view.html.twig" at line 1. in Twig\Loader\ChainLoader->getCacheKey() (line 142 of /webpath/docroot/vendor/twig/twig/src/Loader/ChainLoader.php).
    – Zeroplexer
    Commented Jan 23, 2020 at 14:31
  • 1
    Great advice! By writing the absolute path, then swapping-in @my_theme for /themes/my_theme/templates, I got what I came here for.
    – owenmck
    Commented Jun 23, 2021 at 9:50

I came across this error when I wanted to use a database state, which was created with Version 10.2.2 and my Drupal instance was on 10.1.2.

Updating fixed the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.