{"record":{"id":"f3c5c0e8cc4b8db1","repo":"apple/pkl","slug":"error-f3c5c0","errorCode":null,"errorMessage":"':'","messagePattern":"':'","errorType":"exception","errorClass":"ParseException","httpStatus":null,"severity":"error","filePath":"pkl-core/src/main/java/org/pkl/core/util/json/JsonParser.java","lineNumber":188,"sourceCode":"    var object = handler.startObject();\n    read();\n    if (++nestingLevel > MAX_NESTING_LEVEL) {\n      throw error(\"Nesting too deep\");\n    }\n    skipWhiteSpace();\n    if (readChar('}')) {\n      nestingLevel--;\n      handler.endObject(object);\n      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    }","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-core/src/main/java/org/pkl/core/util/json/JsonParser.java#L170-L206","documentation":"While parsing a JSON object, after reading a member name the parser requires a colon separating the name from its value. readObject calls readChar(':') and, if the next non-whitespace character is not ':', throws this ParseException (via expected(\":\")) with line/column position information. It indicates malformed JSON: a missing colon between an object key and its value.","triggerScenarios":"parse(String) / parse(Reader) on JSON like \"{\\\"a\\\" 1}\" or \"{key: 1}\" (key not quoted, no colon). Specifically: readName succeeded, then the next character was not ':'.","commonSituations":"Hand-written or templated JSON where the colon was dropped, JSON5/JavaScript-style object literals ({key: 1} with unquoted keys) pasted into a context requiring strict JSON, string concatenation that mangles members, or edits to generated config files.","solutions":["Validate the JSON with a linter/formatter before parsing; fix the location the ParseException reports (missing ':' after the object key).","Quote object keys and separate them from values with ':' — strict JSON requires {\"key\": value}, not {key: value}.","If the source is JS-object-like text, convert it to strict JSON first (e.g. JSON5/Hjson parser or manual quoting).","Catch ParseException and surface its position so the offending spot in the input can be corrected quickly."],"exampleFix":"// before\nString json = \"{name \\\"pkl\\\"}\"; // missing ':'\n// after\nString json = \"{\\\"name\\\": \\\"pkl\\\"}\";","handlingStrategy":"validation","validationCode":"// Pre-validate with a strict JSON parser before use\ntry {\n  new jakarta.json.Json().createReader(new StringReader(json)).read();\n} catch (Exception e) {\n  throw new IllegalArgumentException(\"Not strict JSON: \" + e.getMessage());\n}","typeGuard":null,"tryCatchPattern":"try {\n  parser.parse(json);\n} catch (ParseException e) {\n  throw new IllegalArgumentException(\"Malformed JSON at line \" + e.getLocation().line + \", column \" + e.getLocation().column + \": \" + e.getMessage(), e);\n}","preventionTips":["Always generate JSON with a serializer, never string concatenation.","Run JSON files through a formatter/linter in CI.","Remember strict JSON requires quoted keys and colons.","Convert JS-object-literal style config to strict JSON before use."],"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"}