An InvalidOperation error that points to a cycle in template inheritance is triggered when:
a template includes multiple templates that extend the same base
a template includes, multiple times or in a loop, a template that extends a base template
Reproduction steps
A reproduction repo can be found here,
but here's are some examples of problematic templates:
{% for item in items %}
{% include "item.html.j2" %}
{% endfor %}
Or even simply:
{% include "item.html.j2" %}
{% include "item.html.j2" %}
Additional helpful information:
Version of minijinja: 2.0.3
Version of rustc: 1.78.0
Operating system and version: Windows 11
What did you expect
Jinja's behavior in these situations (see reproduction repo for evidence) is to allow the multiple includes. It isn't stated explicitly that I can find, but their documentation implies that includes should work in loops in at least one spot.
Description
An
InvalidOperation
error that points to a cycle in template inheritance is triggered when:include
s multiple templates thatextend
the same baseinclude
s, multiple times or in a loop, a template thatextend
s a base templateReproduction steps
A reproduction repo can be found here, but here's are some examples of problematic templates:
Or even simply:
Additional helpful information:
What did you expect
Jinja's behavior in these situations (see reproduction repo for evidence) is to allow the multiple
include
s. It isn't stated explicitly that I can find, but their documentation implies thatincludes
should work in loops in at least one spot.