Shopify / Shopify/liquid

Is it possible to show error line when there are parsing errors?

Open
#1,413 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
11.9k
Forks
1.5k
Avg merge
17h 55m
Merged PRs (30d)
3

Description

Hi. im trying to test liquid template that errors out with this error:

Traceback (most recent call last):
        9: from run.rb:11:in `<main>'
        8: from /usr/share/gems/gems/liquid-5.0.0/lib/liquid/template.rb:97:in `parse'
        7: from /usr/share/gems/gems/liquid-5.0.0/lib/liquid/template.rb:110:in `parse'
        6: from /usr/share/gems/gems/liquid-5.0.0/lib/liquid/document.rb:7:in `parse'
        5: from /usr/share/gems/gems/liquid-5.0.0/lib/liquid/document.rb:23:in `parse'
        4: from /usr/share/gems/gems/liquid-5.0.0/lib/liquid/document.rb:55:in `parse_body'
        3: from /usr/share/gems/gems/liquid-5.0.0/lib/liquid/block_body.rb:29:in `parse'
        2: from /usr/share/gems/gems/liquid-5.0.0/lib/liquid/block_body.rb:136:in `parse_for_document'
        1: from /usr/share/gems/gems/liquid-5.0.0/lib/liquid/document.rb:57:in `block in parse_body'
/usr/share/gems/gems/liquid-5.0.0/lib/liquid/document.rb:36:in `unknown_tag': Liquid syntax error: Unknown tag 'json' (Liquid::SyntaxError)

Im new to liquid and my code seems fine.

I cannot understand which line this code refers to as I have multiple variables outputted that begin with "json".

Is there a way to enable line numbers in errors?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the parsing flow in lib/liquid/template.rb, lib/liquid/document.rb, and lib/liquid/block_body.rb, which appear in the reported stack trace. Reproduce the unknown-tag error and trace how parsing context is propagated. Done means syntax errors identify the relevant template line, with coverage for the reported case.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.