I have been developing a few websites using D8 over the past few months. An error message I got a lot was this one:

Twig_Error_Runtime: An exception has been thrown during the rendering of a template ("A stray drupal_render() invocation with $is_root_call = TRUE is causing bubbling of attached assets to break.") in "themes/example/templates/menu.html.twig" at line 36. in Twig_Template->displayWithErrorHandling() (line 328 of core/vendor/twig/twig/lib/Twig/Template.php).

In this case I tried to use an Object of Drupal\Core\Template\Attribute as the $attributes paramenter of the Drupal Twig Extension link()

The message doesn't really tell me what went wrong. I think this message appears in a lot of different cases. Can we improve it somehow?

Comments

Lukas von Blarer’s picture

Issue tags: +TX (Themer Experience), +Twig
Cottser’s picture

Title: Improve errors messages from Twig » Improve errors messages from the rendering system
Component: theme system » render system
Category: Feature request » Task
Related issues: +#2482297: A stray drupal_render() invocation with $is_root_call = TRUE is causing bubbling of attached assets to break

You are not alone. I haven't experienced these errors myself but they are coming from render, Twig is just calling render a lot :)

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.