{"record":{"id":"fa9c199c68a8eb0f","repo":"Shopify/liquid","slug":"errors-syntax-for-invalid-in-fa9c19","errorCode":"errors.syntax.for_invalid_in","errorMessage":"options[:locale].t(\"errors.syntax.for_invalid_in\")","messagePattern":"options\\[:locale\\]\\.t\\(\"errors\\.syntax\\.for_invalid_in\"\\)","errorType":"exception","errorClass":"Liquid::SyntaxError","httpStatus":null,"severity":"error","filePath":"lib/liquid/tags/table_row.rb","lineNumber":43,"sourceCode":"  # @liquid_optional_param range [untyped] A custom numeric range to iterate over.\n  class TableRow < Block\n    Syntax = /(\\w+)\\s+in\\s+(#{QuotedFragment}+)/o\n    ALLOWED_ATTRIBUTES = ['cols', 'limit', 'offset', 'range'].freeze\n\n    attr_reader :variable_name, :collection_name, :attributes\n\n    def initialize(tag_name, markup, options)\n      super\n      parse_with_selected_parser(markup)\n    end\n\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","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/Shopify/liquid/blob/807d45a6b3d4568e64e86b375e3702df2c7c860c/lib/liquid/tags/table_row.rb#L25-L61","documentation":"The strict2 parser of the {% tablerow %} tag requires the literal keyword 'in' between the loop variable and the collection. If the parser cannot consume 'in' after the variable name, it raises Liquid::SyntaxError with the localized errors.syntax.for_invalid_in message.","triggerScenarios":"Markup like {% tablerow item items %} (missing 'in'), {% tablerow item in2 items %} (typo), or a parser in strict2 mode being fed a tablerow tag lacking the 'in' keyword.","commonSituations":"Hand-written templates missing 'in'; migrations from lenient parsers where malformed tags used to be tolerated; typos such as 'on' or 'inn'.","solutions":["Add the missing 'in' keyword: {% tablerow item in items %}...{% endtablerow %}.","Fix typos in the keyword ('in' exactly, lowercase).","Run Template.parse on the template in tests to catch the offending tag and line before rendering."],"exampleFix":"// before\n{% tablerow product products %}{{ product.title }}{% endtablerow %}\n// after\n{% tablerow product in products %}{{ product.title }}{% endtablerow %}","handlingStrategy":"validation","validationCode":"raise 'tablerow requires: {% tablerow var in collection %}' unless markup =~ /\\A\\s*\\w+\\s+in\\s+/","typeGuard":"def valid_tablerow_markup?(markup)\n  markup =~ /\\A\\s*[a-zA-Z_]\\w*\\s+in\\s+.+\\z/\nend","tryCatchPattern":"begin\n  Liquid::Template.parse(source)\nrescue Liquid::SyntaxError => e\n  raise \"tablerow markup error: #{e.message}\"\nend","preventionTips":["Always include the 'in' keyword between variable and collection","Run template parse tests in CI","Avoid hand-editing tablerow tags without re-validating"],"tags":["liquid","template-syntax","parse-error","tablerow-tag"],"backgroundTag":"missing-required-argument","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"}