Shopify/liquid · error · Liquid::SyntaxError
errors.syntax.table_row_invalid_attribute
errors.syntax.table_row_invalid_attribute
Error message
options[:locale].t("errors.syntax.table_row_invalid_attribute", attribute: key) What it means
In strict2 parsing, {% tablerow %} only accepts a whitelist of attributes (ALLOWED_ATTRIBUTES such as cols, offset, limit). Any other identifier following a comma raises Liquid::SyntaxError with errors.syntax.table_row_invalid_attribute, naming the offending attribute via the interpolation parameter.
Solutions
- Use only supported attributes: cols, offset, limit (check ALLOWED_ATTRIBUTES in lib/liquid/tags/table_row.rb).
- Correct the attribute spelling, e.g. col -> cols.
- Remove unsupported attributes and implement custom behavior in Ruby code instead of the template.
Example fix
// before
{% tablerow item in items, column: 3 %}{{ item }}{% endtablerow %}
// after
{% tablerow item in items, cols: 3 %}{{ item }}{% endtablerow %} Defensive patterns
Strategy: validation
Validate before calling
ALLOWED = %w[cols offset limit]
attrs = markup.scan(/(\w+)\s*:/).flatten
bad = attrs - ALLOWED
raise "unsupported tablerow attributes: #{bad.join(', ')}" unless bad.empty? Type guard
def allowed_tablerow_attrs?(attrs) (attrs.keys - %w[cols offset limit]).empty? end
Try / catch
begin Liquid::Template.parse(source) rescue Liquid::SyntaxError => e Rails.logger.warn(e.message) raise end
Prevention
- Restrict tablerow attributes to cols/offset/limit
- Check ALLOWED_ATTRIBUTES in lib/liquid/tags/table_row.rb when adding options
- Lint templates before deployment
When it happens
Trigger: {% tablerow item in items, colours: 3 %} or any unknown key: comma-separated identifier that is not in ALLOWED_ATTRIBUTES, while p.look(:id) is true.
Common situations: Misspelling allowed attributes (e.g. 'col' instead of 'cols'); inventing options that the tag does not support; copying syntax from other loop tags like for with unsupported options.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- errors.syntax.for_invalid_in
- errors.syntax.table_row
- errors.syntax.unexpected_else (locale: Unexpected 'else'…
- errors.syntax.invalid_delimiter
- errors.syntax.unknown_tag (locale: 'Unknown tag 'tag'')
AI-assisted analysis of Shopify/liquid@807d45a6b3 (2026-09-08).
Data as JSON: /api/errors/27212529e3993efe.
Report an issue: GitHub.
Appendix: source
Thrown at lib/liquid/tags/table_row.rb:54
def strict2_parse(markup)
p = @parse_context.new_parser(markup)
@variable_name = p.consume(:id)
unless p.id?("in")
raise SyntaxError, options[:locale].t("errors.syntax.for_invalid_in")
end
@collection_name = safe_parse_expression(p)
p.consume?(:comma)
@attributes = {}
while p.look(:id)
key = p.consume
unless ALLOWED_ATTRIBUTES.include?(key)
raise SyntaxError, options[:locale].t("errors.syntax.table_row_invalid_attribute", attribute: key)
end
p.consume(:colon)
@attributes[key] = safe_parse_expression(p)
p.consume?(:comma)
end
p.consume(:end_of_string)
end
def strict_parse(markup)
lax_parse(markup)
end
def lax_parse(markup)
if markup =~ Syntax
@variable_name = Regexp.last_match(1)
@collection_name = parse_expression(Regexp.last_match(2))View on GitHub (pinned to 807d45a6b3)