{"record":{"id":"c7ffd7b8de4e9cdc","repo":"Shopify/liquid","slug":"errors-syntax-variable-termination-locale-varia","errorCode":null,"errorMessage":"errors.syntax.variable_termination (locale: \"Variable '{token}' was not properly terminated with regexp: {tag_end}\")","messagePattern":"errors\\.syntax\\.variable_termination \\(locale: \"Variable '(.+?)' was not properly terminated with regexp: (.+?)\"\\)","errorType":"exception","errorClass":"Liquid::SyntaxError","httpStatus":null,"severity":"error","filePath":"lib/liquid/block_body.rb","lineNumber":82,"sourceCode":"        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\n      when MemoryError\n        raise\n      when UndefinedVariable, UndefinedDropMethod, UndefinedFilter\n        context.handle_error(exc, line_number)\n      else","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/Shopify/liquid/blob/807d45a6b3d4568e64e86b375e3702df2c7c860c/lib/liquid/block_body.rb#L64-L100","documentation":"Liquid raises this SyntaxError when a `{{ ... }}` output expression is never closed with `}}`. raise_missing_variable_terminator mirrors raise_missing_tag_terminator but for variables, using the VariableEnd regexp (`\\}\\}`) in the message.","triggerScenarios":"Writing `{{ user.name` without `}}`; a `}}` consumed by an inner string or nested braces like `{{ a{{b }}`; template truncation; frameworks that treat `{{ }}` as their own syntax (Vue, Jinja conflicts) stripping delimiters.","commonSituations":"Mixing Liquid with Jinja2/Vue/Handlebars in one file; editors or linters auto-removing braces; heredocs/templated configs where escaping eats a brace; hand-rolled string interpolation.","solutions":["Close the variable with `}}` as shown in the error message.","If using another templating layer alongside Liquid, change one layer's delimiters or escape braces.","Balance nested braces/quotes inside the expression.","Validate templates with Liquid::Template.parse in tests before rendering in production."],"exampleFix":"// before\n{{ product.title\n// after\n{{ product.title }}","handlingStrategy":"validation","validationCode":"src.each_line do |l|\n  opens = l.scan('{{').size\n  closes = l.scan('}}').size\n  warn \"unbalanced braces: #{l}\" if opens != closes\nend","typeGuard":"null","tryCatchPattern":"begin\n  Liquid::Template.parse(src)\nrescue Liquid::SyntaxError => e\n  if e.message.include?('Variable') && e.message.include?('terminated')\n    logger.error(\"unterminated liquid variable: #{e.message}\")\n    fallback_template\n  else\n    raise\n  end\nend","preventionTips":["Change delimiters when mixing Liquid with Vue/Jinja in one file, or escape braces.","Count {{ vs }} per line in a lint check.","Avoid hand-building templates via string concatenation that drops braces.","Parse-test templates in CI."],"tags":["liquid","template-syntax","unterminated-variable","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"}