{"record":{"id":"03a6f170bc9cebbc","repo":"Shopify/liquid","slug":"errors-syntax-tag-unexpected-args","errorCode":"errors.syntax.tag_unexpected_args","errorMessage":"parse_context.locale.t(\"errors.syntax.tag_unexpected_args\", tag: tag_name)","messagePattern":"parse_context\\.locale\\.t\\(\"errors\\.syntax\\.tag_unexpected_args\", tag: tag_name\\)","errorType":"exception","errorClass":"Liquid::SyntaxError","httpStatus":null,"severity":"error","filePath":"lib/liquid/tags/raw.rb","lineNumber":55,"sourceCode":"\n    def render_to_output_buffer(_context, output)\n      output << @body\n      output\n    end\n\n    def nodelist\n      [@body]\n    end\n\n    def blank?\n      @body.empty?\n    end\n\n    protected\n\n    def ensure_valid_markup(tag_name, markup, parse_context)\n      unless Syntax.match?(markup)\n        raise SyntaxError, parse_context.locale.t(\"errors.syntax.tag_unexpected_args\", tag: tag_name)\n      end\n    end\n  end\nend\n","sourceCodeStart":37,"sourceCodeEnd":60,"githubUrl":"https://github.com/Shopify/liquid/blob/807d45a6b3d4568e64e86b375e3702df2c7c860c/lib/liquid/tags/raw.rb#L37-L60","documentation":"Raw#ensure_valid_markup raises SyntaxError with the tag_unexpected_args message when the {% raw %} tag's markup is non-empty. Raw takes no arguments; via Tag#parse this is enforced at initialization for any raw tag whose Syntax regex doesn't match empty markup.","triggerScenarios":"{% raw something %}, {% raw data.json %}, or any {% raw %} tag containing additional text after the tag name — anywhere raw tags are parsed (strict and lax alike).","commonSituations":"Attempting to parameterize raw output (misunderstanding that raw is not a filter); copy-paste artifacts leaving stray characters after 'raw'; typos such as {% rawx %}-style edits that leave arguments behind.","solutions":["Remove everything after the tag name: use plain {% raw %} ... {% endraw %}","If you intended to escape/transform data, use filters (e.g. {{ value | json }}) or the {% literal %} construct instead of raw with arguments","Trim whitespace/stray tokens accidentally left after 'raw'"],"exampleFix":"// before\n{% raw %}\n// after\n{% raw %}...{% endraw %}","handlingStrategy":"validation","validationCode":"raise Liquid::SyntaxError, 'raw tag takes no arguments' unless markup.to_s.strip.empty?","typeGuard":"def raw_tag_valid?(markup)\n  markup.to_s.strip.empty?\nend","tryCatchPattern":"begin\n  Liquid::Template.parse(template)\nrescue Liquid::SyntaxError => e\n  if e.message.include?('tag_unexpected_args')\n    logger.error(\"Raw tag given arguments: #{e.message}\")\n  end\n  raise\nend","preventionTips":["{% raw %} never takes arguments — strip anything after the tag name","Use filters or {% literal %} if you need transformation, not raw parameters","Trim accidental whitespace/tokens when hand-editing raw blocks"],"tags":["ruby","liquid","template-syntax","raw-tag"],"backgroundTag":"template-syntax-error","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"}