{"record":{"id":"c9bd1a3f14dca758","repo":"quarkusio/quarkus","slug":"string-not-closed","errorCode":null,"errorMessage":"String not closed","messagePattern":"String not closed","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/builder/src/main/java/io/quarkus/builder/JsonReader.java","lineNumber":242,"sourceCode":"                    case '/': // solidus\n                    case 'b': // backspace\n                    case 'f': // formfeed\n                    case 'n': // linefeed\n                    case 'r': // carriage return\n                    case 't': // horizontal tab\n                        break;\n                    case 'u': // unicode\n                        if (unicodeString == null) {\n                            unicodeString = new StringBuilder(position - start);\n                        }\n                        unicodeString.append(text, start, position - 1);\n                        unicodeString.append(readUnicode());\n                        start = position;\n                }\n            }\n        }\n\n        throw new IllegalArgumentException(\"String not closed\");\n    }\n\n    private char readUnicode() {\n        final char digit1 = Character.forDigit(nextChar(), 16);\n        final char digit2 = Character.forDigit(nextChar(), 16);\n        final char digit3 = Character.forDigit(nextChar(), 16);\n        final char digit4 = Character.forDigit(nextChar(), 16);\n        return (char) (digit1 << 12 | digit2 << 8 | digit3 << 4 | digit4);\n    }\n\n    /**\n     * number\n     * |---- integer fraction exponent\n     */\n    private JsonValue readNumber(int numStartIndex) {\n        final boolean isFraction = skipToEndOfNumber();\n        final String number = text.substring(numStartIndex, position);\n        return isFraction","sourceCodeStart":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/builder/src/main/java/io/quarkus/builder/JsonReader.java#L224-L260","documentation":"readString() consumes characters until it finds the closing double quote. If the loop ends because the end of the input text was reached without seeing '\"', the string literal was never terminated, and the parser throws this IllegalArgumentException. It signals an unterminated JSON string.","triggerScenarios":"Parsing JSON where a string value starts with '\"' but the input ends before the closing quote, e.g. \"{\\\"name\\\":\\\"quarkus}\" or a truncated document; also when an unescaped '\"' earlier inside the string prematurely closed it and left the real terminator orphaned.","commonSituations":"Truncated JSON files or network payloads; hand-written JSON missing a quote; strings containing unescaped inner quotes like \"{\\\"say\\\":\\\"hi \\\"there\\\"\"; generated JSON cut off by a length limit or build-time error.","solutions":["Add the missing closing double quote to the string literal.","Escape any inner double quotes with backslash (\\\") so they do not terminate the string early.","Validate the JSON with a standard parser before use to locate the unterminated string.","Verify the input source was not truncated (file write completed, payload fully received)."],"exampleFix":"// before\nString json = \"{\\\"name\\\":\\\"quarkus}\"; // value string never closed\n\n// after\nString json = \"{\\\"name\\\":\\\"quarkus\\\"}\";","handlingStrategy":"validation","validationCode":"boolean stringsClosed(String json) {\n    int count = 0;\n    for (int i = 0; i < json.length(); i++) {\n        if (json.charAt(i) == '\"' && (i == 0 || json.charAt(i - 1) != '\\\\')) count++;\n    }\n    return count % 2 == 0;\n}\n// call before parsing: if (!stringsClosed(input)) throw new IllegalArgumentException(\"unterminated string\");","typeGuard":null,"tryCatchPattern":"try {\n    JsonReader.parse(json);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().equals(\"String not closed\")) {\n        throw new ConfigException(\"Unterminated JSON string literal; add the missing closing quote or escape inner quotes\", e);\n    }\n    throw e;\n}","preventionTips":["Escape inner double quotes as \\\" inside JSON string values","Check that input files/payloads were not truncated before parsing","Prefer a serializer library over manual JSON construction"],"tags":["json","parser","syntax-error"],"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-12T22:17:10.623Z"}