{"record":{"id":"27212529e3993efe","repo":"Shopify/liquid","slug":"errors-syntax-table-row-invalid-attribute","errorCode":"errors.syntax.table_row_invalid_attribute","errorMessage":"options[:locale].t(\"errors.syntax.table_row_invalid_attribute\", attribute: key)","messagePattern":"options\\[:locale\\]\\.t\\(\"errors\\.syntax\\.table_row_invalid_attribute\", attribute: key\\)","errorType":"exception","errorClass":"Liquid::SyntaxError","httpStatus":null,"severity":"error","filePath":"lib/liquid/tags/table_row.rb","lineNumber":54,"sourceCode":"\n    def strict2_parse(markup)\n      p = @parse_context.new_parser(markup)\n\n      @variable_name = p.consume(:id)\n\n      unless p.id?(\"in\")\n        raise SyntaxError, options[:locale].t(\"errors.syntax.for_invalid_in\")\n      end\n\n      @collection_name = safe_parse_expression(p)\n\n      p.consume?(:comma)\n\n      @attributes = {}\n      while p.look(:id)\n        key = p.consume\n        unless ALLOWED_ATTRIBUTES.include?(key)\n          raise SyntaxError, options[:locale].t(\"errors.syntax.table_row_invalid_attribute\", attribute: key)\n        end\n\n        p.consume(:colon)\n        @attributes[key] = safe_parse_expression(p)\n        p.consume?(:comma)\n      end\n\n      p.consume(:end_of_string)\n    end\n\n    def strict_parse(markup)\n      lax_parse(markup)\n    end\n\n    def lax_parse(markup)\n      if markup =~ Syntax\n        @variable_name   = Regexp.last_match(1)\n        @collection_name = parse_expression(Regexp.last_match(2))","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/Shopify/liquid/blob/807d45a6b3d4568e64e86b375e3702df2c7c860c/lib/liquid/tags/table_row.rb#L36-L72","documentation":"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.","triggerScenarios":"{% 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.","commonSituations":"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.","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."],"exampleFix":"// before\n{% tablerow item in items, column: 3 %}{{ item }}{% endtablerow %}\n// after\n{% tablerow item in items, cols: 3 %}{{ item }}{% endtablerow %}","handlingStrategy":"validation","validationCode":"ALLOWED = %w[cols offset limit]\nattrs = markup.scan(/(\\w+)\\s*:/).flatten\nbad = attrs - ALLOWED\nraise \"unsupported tablerow attributes: #{bad.join(', ')}\" unless bad.empty?","typeGuard":"def allowed_tablerow_attrs?(attrs)\n  (attrs.keys - %w[cols offset limit]).empty?\nend","tryCatchPattern":"begin\n  Liquid::Template.parse(source)\nrescue Liquid::SyntaxError => e\n  Rails.logger.warn(e.message)\n  raise\nend","preventionTips":["Restrict tablerow attributes to cols/offset/limit","Check ALLOWED_ATTRIBUTES in lib/liquid/tags/table_row.rb when adding options","Lint templates before deployment"],"tags":["liquid","template-syntax","tablerow-tag","invalid-attribute"],"backgroundTag":"invalid-argument-value","analyzedSha":"807d45a6b3d4568e64e86b375e3702df2c7c860c","analyzedAt":"2026-09-08T11:31:38.917Z","contentChangedAt":"2026-09-08T11:31:38.917Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}