{"record":{"id":"4fb01983492c233a","repo":"Shopify/liquid","slug":"invalid-integer","errorCode":null,"errorMessage":"invalid integer","messagePattern":"invalid integer","errorType":"exception","errorClass":"Liquid::ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/liquid/tags/table_row.rb","lineNumber":134,"sourceCode":"        end\n      end\n\n      output << \"</tr>\\n\"\n      output\n    end\n\n    class ParseTreeVisitor < Liquid::ParseTreeVisitor\n      def children\n        super + @node.attributes.values + [@node.collection_name]\n      end\n    end\n\n    private\n\n    def to_integer(value)\n      value.to_i\n    rescue NoMethodError\n      raise Liquid::ArgumentError, \"invalid integer\"\n    end\n  end\nend\n","sourceCodeStart":116,"sourceCodeEnd":138,"githubUrl":"https://github.com/Shopify/liquid/blob/807d45a6b3d4568e64e86b375e3702df2c7c860c/lib/liquid/tags/table_row.rb#L116-L138","documentation":"TableRow#to_integer calls value.to_i and, if the object does not respond to to_i (NoMethodError), re-raises Liquid::ArgumentError with message 'invalid integer'. It guards the cols/offset/limit attributes of {% tablerow %}, which must be integer-convertible.","triggerScenarios":"Passing an object without to_i (e.g. nil in some configurations, a Hash, or a Drop) as the value of cols/offset/limit in {% tablerow %}, resolved during render_to_output_buffer.","commonSituations":"Assigning a complex object or nil to a variable used for cols; API/drop objects that do not implement to_i; typos where a string with units ('10px') is expected to work but the object lacks to_i.","solutions":["Ensure the attribute value is an Integer or something responding to to_i (e.g. a numeric String).","Convert drops/objects to numbers in Ruby before assigning them in the template.","Use literal integers in the tag: cols: 3."],"exampleFix":"// before\n{% assign cfg = site.layout %}{% tablerow item in items, cols: cfg %}...{% endtablerow %}\n// after\n{% tablerow item in items, cols: 3 %}...{% endtablerow %}","handlingStrategy":"type-guard","validationCode":"raise ArgumentError, 'cols must respond to to_i' unless value.respond_to?(:to_i) || value.is_a?(Integer)","typeGuard":"def integer_value?(v)\n  v.is_a?(Integer) || v.respond_to?(:to_i)\nend","tryCatchPattern":"begin\n  output = template.render(assigns)\nrescue Liquid::ArgumentError => e\n  raise e if e.message == 'invalid integer'\n  raise\nend","preventionTips":["Pass literal integers or numeric strings for cols/offset/limit","Convert drops to integers in Ruby before assigning","Never bind layout/config objects directly to numeric tag attributes"],"tags":["liquid","type-error","tablerow-tag","argument-error"],"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"}