Problem/Motivation

Found two warnings in dblog

Warning: Undefined array key "type" in Drupal\Core\Theme\ThemeManager->render() (Zeile 292 in html/core/lib/Drupal/Core/Theme/ThemeManager.php).:

Warning: Undefined array key "template" in Drupal\Core\Theme\ThemeManager->render() (Zeile 333 in html/core/lib/Drupal/Core/Theme/ThemeManager.php).:

Steps to reproduce

Don't remove from /html/sites/development.services.yml

  twig.config:
    debug: true
    auto_reload: true

part.

Proposed resolution

Use admin/config/development/settings instead

CommentFileSizeAuthor
#3 Screenshot 2024-07-22 at 1.28.22 PM.png82.58 KBsamitk

Comments

djdemonNet created an issue. See original summary.

quietone’s picture

Version: 10.2.x-dev » 11.x-dev

Fixes are made on on 11.x (our main development branch) first, and are then back ported as needed according to our policies. Also, 10.2 is in security mode now.

samitk’s picture

Status: Active » Postponed (maintainer needs more info)
StatusFileSize
new82.58 KB

Hi @dmytro.chornyi,

I verified it both in 10.2.x and 11.x, i am not able to reproduce it at my end, I added following code in sites/development.services.yml

twig.config:
    debug: true
    auto_reload: true

Also checked all the check-boxes on admin/config/development/settings page. Adding screenshot for the reference.

It might me the Theme issue. Can you please share all the details like the theme name etc.

Thanks
Samit K.

malhar_c’s picture

Don't know if this is relevant but here's a quick fix that worked for me. I'm on Drupal 10.3.1 though, and I faced this exact warning while customising the default user login page using hook_theme_suggestions_alter() and hook_theme_registry_alter(), but this might help others as well, if you are in similar endeavour.

<?php
$theme_registry['page__custom_page']['type'] = 'base_theme_engine';

Setting the type key for the theme suggestion directly in the theme registry resolves it.

Cheers :)
Malhar

dmytro.chornyi’s picture

smustgrave’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)
Issue tags: +Bug Smash Initiative

Since there's been no follow up to reproduce this going to close out. If still an issue in D11 please re-open updating summary.

mykola dolynskyi’s picture

I am also getting this warning after updated to d11 latest.

In custom module I define hook_theme() and there custom theme hooks with template names. However it warns me about empty template and next render chain is failing

The website encountered an unexpected error. Try again later.

Twig\Error\LoaderError: Template "modules/custom/mymodule/templates/.html.twig" is not defined. in Twig\Loader\ChainLoader->getCacheKey() (line 111 of /var/www/vhosts/myhost/httpdocs/updates/vendor/twig/twig/src/Loader/ChainLoader.php).
Twig\Environment->getTemplateClass() (Line: 204)
Drupal\Core\Template\TwigEnvironment->getTemplateClass() (Line: 370)
Twig\Environment->load() (Line: 34)
twig_render_template() (Line: 380)
Drupal\Core\Theme\ThemeManager->render() (Line: 497)
Drupal\Core\Render\Renderer->doRender() (Line: 227)
Drupal\Core\Render\Renderer->render() (Line: 242)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 627)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 235)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare() (Line: 131)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray() (Line: 246)
Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}() (Line: 206)
Symfony\Component\EventDispatcher\EventDispatcher->callListeners() (Line: 56)
Symfony\Component\EventDispatcher\EventDispatcher->dispatch() (Line: 188)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 53)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 715)
Drupal\Core\DrupalKernel->handle() (Line: 19)

This was working on drupal 9.5 before