{"record":{"id":"dab67a8eb35cc5e5","repo":"apple/pkl","slug":"missingdelimiter","errorCode":"missingDelimiter","errorMessage":"Missing `}` delimiter.","messagePattern":"Missing `\\}` delimiter\\.","errorType":"error_code","errorClass":"ParserError","httpStatus":null,"severity":"error","filePath":"pkl-parser/src/main/java/org/pkl/parser/ParserImpl.java","lineNumber":435,"sourceCode":"    }\n    children.add(body);\n\n    return new Class(children, modifiersOffset, nameOffset, startSpan.endWith(end));\n  }\n\n  private ClassBody parseClassBody() {\n    var start = expect(Token.LBRACE, \"missingDelimiter\", \"{\").span;\n    var children = new ArrayList<Node>();\n    while (lookahead != Token.RBRACE && lookahead != Token.EOF) {\n      var entryHeader = parseMemberHeader();\n      if (lookahead == Token.FUNCTION) {\n        children.add(parseClassMethod(entryHeader));\n      } else {\n        children.add(parseClassProperty(entryHeader));\n      }\n    }\n    if (lookahead == Token.EOF) {\n      throw new ParserError(\n          ErrorMessages.create(\"missingDelimiter\", \"}\"), prev.span.stopSpan().move(1));\n    }\n    var end = expect(Token.RBRACE, \"missingDelimiter\", \"}\").span;\n    return new ClassBody(children, start.endWith(end));\n  }\n\n  private ClassProperty parseClassProperty(MemberHeader header) {\n    var name = parseIdentifier();\n    var start = header.span(name.span());\n    var children = new ArrayList<@Nullable Node>();\n    children.add(header.docComment);\n    children.addAll(header.annotations);\n    var modifiersOffset = header.annotations.size() + 1;\n    children.addAll(header.modifiers);\n    var nameOffset = modifiersOffset + header.modifiers.size();\n    TypeAnnotation typeAnnotation = null;\n    Expr expr = null;\n    var bodies = new ArrayList<ObjectBody>();","sourceCodeStart":417,"sourceCodeEnd":453,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-parser/src/main/java/org/pkl/parser/ParserImpl.java#L417-L453","documentation":"When parsing a Pkl class body, the parser reached end-of-file (or a token that is not '}') without finding the closing '}' of the class. The parser first reports a dedicated error at EOF and otherwise fails expecting Token.RBRACE, both producing this missingDelimiter error at the position after the last token.","triggerScenarios":"Parsing a .pkl file whose class declaration is missing its closing brace — e.g. truncated file, an unclosed `{` after `class Foo {`, or a brace consumed by an earlier syntax error inside a property/method.","commonSituations":"Cut-off files from bad merges or incomplete saves, editors auto-inserting but user deleting braces, unbalanced braces in string interpolations or comments confusing counting, and nested class/amendment syntax mistakes.","solutions":["Add the missing closing '}' at the reported span (end of file or at the noted position)","Count and balance braces in the class body; check that string interpolations \"\\(...)\" are properly closed","Recover the file from version control if it was truncated by a merge or failed write","Use a Pkl editor/formatter to locate the unbalanced brace before the reported location"],"exampleFix":"// before\nclass Person {\n  name: String\n// after\nclass Person {\n  name: String\n}","handlingStrategy":"validation","validationCode":"// quick brace balance sanity check before evaluating a .pkl file\nlong opens = content.chars().filter(c -> c == '{').count();\nlong closes = content.chars().filter(c -> c == '}').count();\nif (opens != closes) throw new IllegalStateException(\"Unbalanced braces in \" + path);","typeGuard":null,"tryCatchPattern":"try {\n  module = Module.loadSource(source);\n} catch (ParserError e) {\n  if (e.getErrorCode().equals(\"missingDelimiter\")) {\n    System.err.println(\"Missing '}' near \" + e.getSpan() + \"; check class/property braces\");\n  }\n  throw e;\n}","preventionTips":["Use a Pkl-aware editor/formatter with bracket matching","Check files after merges or interrupted writes before committing","Close string interpolations `${...}` carefully — nested braces confuse manual counting","Run pkl eval on generated files in CI to catch syntax errors early"],"tags":["pkl","parser","syntax-error","missing-delimiter"],"backgroundTag":"missing-delimiter","analyzedSha":"f3efcbfc9b60d30053b0536d664948d7aa1b8673","analyzedAt":"2026-09-08T13:10:45.570Z","contentChangedAt":"2026-09-08T13:10:45.570Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}