{"record":{"id":"2140410e3c3bd6be","repo":"Shopify/liquid","slug":"errors-syntax-invalid-delimiter-locale-tag-i","errorCode":null,"errorMessage":"errors.syntax.invalid_delimiter (locale: '{tag}' is not a valid delimiter for 'block_name' tags. use 'block_delimiter')","messagePattern":"errors\\.syntax\\.invalid_delimiter \\(locale: '(.+?)' is not a valid delimiter for 'block_name' tags\\. use 'block_delimiter'\\)","errorType":"exception","errorClass":"Liquid::SyntaxError","httpStatus":null,"severity":"error","filePath":"lib/liquid/block.rb","lineNumber":44,"sourceCode":"    end\n\n    def nodelist\n      @body.nodelist\n    end\n\n    def unknown_tag(tag_name, _markup, _tokenizer)\n      Block.raise_unknown_tag(tag_name, block_name, block_delimiter, parse_context)\n    end\n\n    # @api private\n    def self.raise_unknown_tag(tag, block_name, block_delimiter, parse_context)\n      if tag == 'else'\n        raise SyntaxError, parse_context.locale.t(\n          \"errors.syntax.unexpected_else\",\n          block_name: block_name,\n        )\n      elsif tag.start_with?('end')\n        raise SyntaxError, parse_context.locale.t(\n          \"errors.syntax.invalid_delimiter\",\n          tag: tag,\n          block_name: block_name,\n          block_delimiter: block_delimiter,\n        )\n      else\n        raise SyntaxError, parse_context.locale.t(\"errors.syntax.unknown_tag\", tag: tag)\n      end\n    end\n\n    def raise_tag_never_closed(block_name)\n      raise SyntaxError, parse_context.locale.t(\"errors.syntax.tag_never_closed\", block_name: block_name)\n    end\n\n    def block_name\n      @tag_name\n    end\n","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/Shopify/liquid/blob/807d45a6b3d4568e64e86b375e3702df2c7c860c/lib/liquid/block.rb#L26-L62","documentation":"Liquid raises this SyntaxError when a block is closed with an `end...` tag that is not the delimiter the opening block expects — e.g. `{% tablerow %} ... {% endfor %}`. raise_unknown_tag checks tag.start_with?('end') and reports the actual tag, the block name, and the correct delimiter.","triggerScenarios":"Closing `{% for %}` with `{% endfor2 %}`-style typos; mismatched pairs like `{% capture %}...{% endcomment %}`; closing a custom block with another block's end tag; `{% endraw %}` without `{% raw %}`.","commonSituations":"Hand-edited templates where an opening tag was renamed but the closing tag was not; nested blocks copied with wrong closers; custom tags whose delimiter string differs from the default (e.g. `end_<name>` mismatch).","solutions":["Make the closing tag exactly the expected delimiter: `{% if %}...{% endif %}`, `{% for %}...{% endfor %}`, etc.","Search the template for the opening tag named in the error and fix its matching closer.","Check nesting order — an inner block may have swallowed the outer block's closer.","For custom blocks, ensure the delimiter registered with syntax matches the `end...` tag authors write."],"exampleFix":"// before\n{% capture greeting %}\n  hello\n{% endcomment %}\n// after\n{% capture greeting %}\n  hello\n{% endcapture %}","handlingStrategy":"validation","validationCode":"BLOCK_DELIMS = { 'if'=>'endif', 'for'=>'endfor', 'capture'=>'endcapture', 'case'=>'endcase', 'unless'=>'endunless', 'raw'=>'endraw', 'tablerow'=>'endtablerow', 'comment'=>'endcomment' }\nsrc.scan(/{%-?\\s*(\\w+)/).flatten.each_cons(2) { } # lint: pair each opener with correct end tag per BLOCK_DELIMS","typeGuard":"null","tryCatchPattern":"begin\n  Liquid::Template.parse(src)\nrescue Liquid::SyntaxError => e\n  raise if e.message !~ /not a valid delimiter/\n  logger.error(\"block delimiter mismatch: #{e.message}\")\n  fallback_template\nend","preventionTips":["Let the editor auto-insert closing tags when you type an opening block tag.","Match open/close pairs innermost-first when hand-editing.","Never rename an opening tag without its closer.","Write a lint step that checks tag pairing."],"tags":["liquid","template-syntax","parse-error"],"backgroundTag":"invalid-argument-format","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"}