{"record":{"id":"5e24d893ccae26ad","repo":"Shopify/liquid","slug":"errors-syntax-tag-termination-locale-tag-toke","errorCode":null,"errorMessage":"errors.syntax.tag_termination (locale: \"Tag '{token}' was not properly terminated with regexp: {tag_end}\")","messagePattern":"errors\\.syntax\\.tag_termination \\(locale: \"Tag '(.+?)' was not properly terminated with regexp: (.+?)\"\\)","errorType":"exception","errorClass":"Liquid::SyntaxError","httpStatus":null,"severity":"error","filePath":"lib/liquid/block_body.rb","lineNumber":77,"sourceCode":"          end\n          new_tag = tag.parse(tag_name, markup, tokenizer, parse_context)\n          @blank &&= new_tag.blank?\n          @nodelist << new_tag\n        end\n        parse_context.line_number = tokenizer.line_number\n      end\n\n      yield nil, nil\n    end\n\n    # @api private\n    def self.unknown_tag_in_liquid_tag(tag, parse_context)\n      Block.raise_unknown_tag(tag, 'liquid', '%}', parse_context)\n    end\n\n    # @api private\n    def self.raise_missing_tag_terminator(token, parse_context)\n      raise SyntaxError, parse_context.locale.t(\"errors.syntax.tag_termination\", token: token, tag_end: TagEnd.inspect)\n    end\n\n    # @api private\n    def self.raise_missing_variable_terminator(token, parse_context)\n      raise SyntaxError, parse_context.locale.t(\"errors.syntax.variable_termination\", token: token, tag_end: VariableEnd.inspect)\n    end\n\n    # @api private\n    def self.render_node(context, output, node)\n      node.render_to_output_buffer(context, output)\n    rescue => exc\n      blank_tag = !node.instance_of?(Variable) && node.blank?\n      rescue_render_node(context, output, node.line_number, exc, blank_tag)\n    end\n\n    # @api private\n    def self.rescue_render_node(context, output, line_number, exc, blank_tag)\n      case exc","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/Shopify/liquid/blob/807d45a6b3d4568e64e86b375e3702df2c7c860c/lib/liquid/block_body.rb#L59-L95","documentation":"Liquid raises this SyntaxError when a `{% ... %}` tag is never closed with the tag-end delimiter (`%}`), detected during block body parsing. raise_missing_tag_terminator is invoked when the scanner reaches EOF (or an unexpected token boundary) while still inside a tag, showing the raw token and the expected terminator regexp.","triggerScenarios":"Writing `{% if x }` or `{% assign y = 1` (missing `%}`); an editor stripping `%}`; unquoted strings containing characters that swallow the terminator like `{% assign x = \"a%}\" ...` mis-nesting; truncated template files.","commonSituations":"Hand-writing templates in editors without Liquid syntax highlighting; minifiers or HTML sanitizers mangling `%}`; copy/paste losing characters; templates stored in YAML/JSON where `}` escaping goes wrong.","solutions":["Add the missing `%}` terminator to the tag shown in the error.","Check that quotes inside the tag are balanced — an unclosed string can hide the `%}`.","Verify the file wasn't truncated or mangled by a build/minify step.","Use an editor with Liquid syntax highlighting to spot unterminated tags early."],"exampleFix":"// before\n{% assign title = page.title }\n// after\n{% assign title = page.title %}","handlingStrategy":"validation","validationCode":"src.scan(/{%(?!%).*?[^%]\\z/) # sanity: ensure every `{%` on a line has a following `%}`\nsrc.each_line { |l| warn \"unterminated tag: #{l}\" if l.include?('{%') && !l.include?('%}') }","typeGuard":"null","tryCatchPattern":"begin\n  Liquid::Template.parse(src)\nrescue Liquid::SyntaxError => e\n  if e.message.include?('was not properly terminated')\n    logger.error(\"unterminated liquid tag: #{e.message}\")\n    fallback_template\n  else\n    raise\n  end\nend","preventionTips":["Use Liquid-aware syntax highlighting to spot missing `%}`.","Balance quotes inside tags before adding the terminator.","Beware minifiers/sanitizers that strip `%}`.","Keep templates in files, not shell-escaped strings, to avoid mangling."],"tags":["liquid","template-syntax","unterminated-tag","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"}