{"record":{"id":"9bbb16094ac2f4cd","repo":"apple/pkl","slug":"or-9bbb16","errorCode":null,"errorMessage":"',' or '}'","messagePattern":"',' or '\\}'","errorType":"exception","errorClass":"ParseException","httpStatus":null,"severity":"error","filePath":"pkl-core/src/main/java/org/pkl/core/util/json/JsonParser.java","lineNumber":197,"sourceCode":"      return;\n    }\n    do {\n      skipWhiteSpace();\n      handler.startObjectName(object);\n      var name = readName();\n      handler.endObjectName(object, name);\n      skipWhiteSpace();\n      if (!readChar(':')) {\n        throw expected(\"':'\");\n      }\n      skipWhiteSpace();\n      handler.startObjectValue(object, name);\n      readValue();\n      handler.endObjectValue(object, name);\n      skipWhiteSpace();\n    } while (readChar(','));\n    if (!readChar('}')) {\n      throw expected(\"',' or '}'\");\n    }\n    nestingLevel--;\n    handler.endObject(object);\n  }\n\n  private String readName() throws IOException {\n    if (current != '\"') {\n      throw expected(\"name\");\n    }\n    return readStringInternal();\n  }\n\n  private void readNull() throws IOException {\n    handler.startNull();\n    read();\n    readRequiredChar('u');\n    readRequiredChar('l');\n    readRequiredChar('l');","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-core/src/main/java/org/pkl/core/util/json/JsonParser.java#L179-L215","documentation":"After each object member value, the parser expects either a comma (to continue with more members) or a closing brace. If neither is found, readObject throws expected(\",\" or \"}\"). This catches malformed JSON such as missing commas between members, trailing commas followed by garbage, or an unclosed object at end of input.","triggerScenarios":"parse() on input like \"{\\\"a\\\":1 \\\"b\\\":2}\" (missing comma), \"{\\\"a\\\":1,}\" followed by something other than '}', or \"{\\\"a\\\":1\" (EOF where '}' was expected).","commonSituations":"Hand-edited JSON files with missing commas, trailing commas copied from JavaScript (legal in JS objects, illegal in strict JSON), string concatenation of fragments that omits separators, truncated responses stored to disk.","solutions":["Run the input through a JSON validator/formatter; the ParseException position points at the character where ',' or '}' was missing.","Remove trailing commas before the closing '}' — strict JSON forbids them.","Insert the missing ',' between consecutive object members or add the closing '}'.","If input is truncated, check the producer/upstream for the complete document before parsing."],"exampleFix":"// before\nString json = \"{\\\"a\\\": 1, \\\"b\\\": 2,}\"; // trailing comma\n// after\nString json = \"{\\\"a\\\": 1, \\\"b\\\": 2}\";","handlingStrategy":"validation","validationCode":"// Strip trailing commas and validate before parsing\nString cleaned = json.replaceAll(\",\\\\s*([}\\\\]])\", \"$1\");\n// then validate with any strict JSON parser before parse()","typeGuard":null,"tryCatchPattern":"try {\n  parser.parse(json);\n} catch (ParseException e) {\n  throw new IllegalArgumentException(\"Malformed object syntax at \" + e.getLocation().line + \":\" + e.getLocation().column + \" — expected ',' or '}'\", e);\n}","preventionTips":["Remove trailing commas — they are invalid in strict JSON.","Use a JSON formatter on hand-edited files before committing.","Generate documents with a serializer instead of concatenating fragments.","Check for truncated input (verify end of document) before parsing."],"tags":["json","parser","syntax-error","pkl"],"backgroundTag":"json-parse-error","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"}