Rendering continues after Liquid::StackLevelError which can result in a lot of similar errors with recursion
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 11.9k
- Forks
- 1.5k
- Avg merge
- 17h 55m
- Merged PRs (30d)
- 3
Description
In Shopify, create a page template page.test2.liquid
{% layout none %}
{% assign aacounter = 1 %}
{% include 'aaaaa' %}
Create a snippet aaaaa.liquid
{{ aacounter }} {% assign aacounter = aacounter | plus: 1 %}
({% include 'aaaaa' %})
{% if aacounter < 10000 %}
[{% include 'aaaaa' %}]
{% endif %}
a
Create a page and set it to the template. Launch the page.
Interestingly, because the snippet was included twice, it bypasses the MAX_DEPTH of 100 and continues the recursion forever. Eventually, Shopify server times out and kills the thread, then gives an error page. In the above example, 10000 would still work and give an output.

But if you set it to 15000 (or remove the check altogether), it will give the error page below:

This happens for both include and render. Related issue: #970
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the page.test2.liquid template and recursive aaaaa.liquid snippet, testing both include and render. Start by tracing how a Liquid::StackLevelError is handled during rendering; done means rendering stops after the error instead of continuing recursion until a timeout or repeated errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100