{"record":{"id":"6d19f8353ea42125","repo":"quarkusio/quarkus","slug":"unknown-start-character-for-json-value-ch","errorCode":null,"errorMessage":"Unknown start character for json value: ${ch}","messagePattern":"Unknown start character for json value: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/json/src/main/java/io/quarkus/bootstrap/json/JsonReader.java","lineNumber":76,"sourceCode":"\n        switch (ch) {\n            case '{':\n                return readObject();\n            case '[':\n                return readArray();\n            case '\"':\n                return readString();\n            case 't':\n                return readConstant(\"true\", JsonBoolean.TRUE);\n            case 'f':\n                return readConstant(\"false\", JsonBoolean.FALSE);\n            case 'n':\n                return readConstant(\"null\", JsonNull.INSTANCE);\n            default:\n                if (Character.isDigit(ch) || '-' == ch) {\n                    return readNumber(position);\n                }\n                throw new IllegalArgumentException(\"Unknown start character for json value: \" + ch);\n        }\n    }\n\n    /**\n     * object\n     * |---- '{' ws '}'\n     * |---- '{' members '}'\n     * </p>\n     * members\n     * |----- member\n     * |----- member ',' members\n     */\n    private JsonValue readObject() {\n        position++;\n\n        Map<JsonString, JsonValue> members = new HashMap<>();\n\n        while (position < length) {","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/json/src/main/java/io/quarkus/bootstrap/json/JsonReader.java#L58-L94","documentation":"readValue() dispatches on the first character of a JSON value ('{', '[', '\"', digits, '-', 't', 'f', 'n'). If the character matches none of these, the input is not valid JSON at that position and the reader throws IllegalArgumentException including the offending character code. This usually means stray characters or structural mistakes in the JSON text.","triggerScenarios":"Input contains an unexpected character where a value should start, e.g. an unquoted word, a single-quoted string ('...'), a trailing comma followed by '}', or garbage bytes after a top-level value.","commonSituations":"Hand-written JSON with unquoted keys/values or single quotes; concatenating two JSON documents; responses from a non-JSON endpoint (HTML error pages) being fed to the parser.","solutions":["Validate the JSON with a linter/validator and fix the character at the reported position","Quote strings with double quotes only; remove stray commas or characters before parsing","Confirm the response/content is actually JSON (check Content-Type) before parsing"],"exampleFix":"// before\nreader.parse(\"{name: 'x'}\"); // single quotes, unquoted key\n// after\nreader.parse(\"{\\\"name\\\": \\\"x\\\"}\");","handlingStrategy":"validation","validationCode":"// Cheap pre-check for an obviously non-JSON first character\nchar first = jsonText.stripLeading().charAt(0);\nif (first != '{' && first != '[') {\n    throw new IllegalArgumentException(\"Input does not look like JSON, starts with: \" + first);\n}","typeGuard":null,"tryCatchPattern":"try {\n    JsonValue v = new JsonReader(text).read();\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Unknown start character\")) {\n        // inspect the character code in the message; fix or reject the input\n    }\n}","preventionTips":["Double-quote all JSON strings and keys; never use single quotes","Validate documents with a JSON linter before feeding them to the parser","Check Content-Type of HTTP responses is application/json before parsing"],"tags":["json","parser","syntax"],"backgroundTag":"malformed-json-input","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}