{"record":{"id":"414836777583e591","repo":"hibernate/hibernate-orm","slug":"character-is-not-the-next-non-blank-character","errorCode":null,"errorMessage":"character [{}] is not the next non-blank character","messagePattern":"character \\[(.+?)\\] is not the next non-blank character","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/type/format/StringJsonDocumentReader.java","lineNumber":302,"sourceCode":"\t */\n\n\tprivate void moveTo(char character) throws IllegalStateException {\n\t\tint pointer = this.position;\n\t\twhile ( pointer < this.limit) {\n\t\t\tchar c = this.jsonString.charAt( pointer );\n\t\t\tif ( c == character) {\n\t\t\t\tthis.position = pointer == this.position?this.position:pointer - 1;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!Character.isWhitespace(c)) {\n\t\t\t\t// we did find an unexpected character\n\t\t\t\t// let the exception raise\n\t\t\t\t//this.json.reset();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tpointer++;\n\t\t}\n\t\tthrow new IllegalStateException(\"character [\" + character + \"] is not the next non-blank character\");\n\t}\n\n\tprivate int nextQuote() {\n\t\tint pointer = this.position;\n\n\t\twhile ( pointer < this.limit) {\n\t\t\tfinal char c = this.jsonString.charAt( pointer );\n\t\t\tif (c == ESCAPE_CHAR) {\n\t\t\t\tpointer++;\n\t\t\t}\n\t\t\telse if (c == '\"') {\n\t\t\t\t// found\n\t\t\t\treturn pointer;\n\t\t\t}\n\t\t\tpointer++;\n\t\t}\n\t\treturn -1;\n\t}","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/type/format/StringJsonDocumentReader.java#L284-L320","documentation":"moveTo(character) skips whitespace and asserts that a specific character (always the opening quote, since its only caller is consumeQuotedString()) is the next non-blank character; it throws when some other non-blank character appears first, naming the expected character in the message. In current code paths the position is already on the quote when this runs, so reaching this exception implies corrupted parser state or an unexplored edge case rather than ordinary bad input.","triggerScenarios":"Not reachable through normal public usage: consumeQuotedString() is only invoked from the QUOTE case of next() after moveBufferPosition(-1) puts the position back on the '\"'. Would surface from an internal regression or from sharing one reader instance across threads (the reader is stateful and not thread-safe).","commonSituations":"Virtually unseen; treat as a Hibernate bug signal if it occurs — typically alongside concurrent use of a single StringJsonDocumentReader.","solutions":["Reproduce with the exact JSON string and capture the stack trace","Audit for a reader instance shared between threads; use one reader per document/thread","Report to Hibernate JIRA with the payload and access pattern"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    while (reader.hasNext()) { handle(reader.next()); }\n} catch (IllegalStateException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"is not the next non-blank character\")) {\n        // internal parser-state failure: collect payload for a Hibernate bug report\n        log.error(\"StringJsonDocumentReader state corruption\", e);\n    }\n    throw e;\n}","preventionTips":["Use one StringJsonDocumentReader per document; never share it across threads","Do not hold reader references between requests in pooled/thread-recycled code","Capture the exact JSON payload when this fires - it is needed upstream"],"tags":["hibernate","json","parser","thread-safety","internal-invariant"],"backgroundTag":"json-parse-error","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}