{"record":{"id":"5844b6b50ebb3582","repo":"hibernate/hibernate-orm","slug":"unexpected-marker-at-position","errorCode":null,"errorMessage":"unexpected marker [{}] at position {}","messagePattern":"unexpected marker \\[(.+?)\\] at position (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/type/format/StringJsonDocumentReader.java","lineNumber":224,"sourceCode":"\t\t\t\t\t// put back what we've read\n\t\t\t\t\tmoveBufferPosition(-1);\n\t\t\t\t\tfinal int valueSize = consumeNonStringValue();\n\t\t\t\t\tif (valueSize == -1) {\n\t\t\t\t\t\tthrow new IllegalStateException( \"Unrecognized marker: \" + StringJsonDocumentMarker.markerOf(\n\t\t\t\t\t\t\t\tthis.jsonString.charAt( this.position )));\n\t\t\t\t\t}\n\t\t\t\t\tswitch ( this.processingStates.getCurrent() ) {\n\t\t\t\t\t\tcase ARRAY:\n\t\t\t\t\t\tcase OBJECT:\n\t\t\t\t\t\t\treturn getUnquotedValueType(this.jsonString.charAt( this.jsonValueStart));\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tthrow new IllegalStateException( \"unexpected read [\"+\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tthis.jsonString.substring( this.jsonValueStart,this.jsonValueEnd )+\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"] in current processing state \" +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tthis.processingStates.getCurrent() );\n\t\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tthrow new IllegalStateException( \"unexpected marker [\"+\n\t\t\t\t\t\t\t\t\t\t\t\t\tmarker +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"] at position \" + this.position );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthrow new IllegalStateException( \"unexpected end of JSON [\"+\n\t\t\t\t\t\t\t\t\t\tthis.jsonString.substring( this.jsonValueStart,this.jsonValueEnd )+\n\t\t\t\t\t\t\t\t\t\t\"] in current processing state \" +\n\t\t\t\t\t\t\t\t\t\tthis.processingStates.getCurrent() );\n\t}\n\n\t/**\n\t * Gets the type of unquoted value.\n\t * We assume that the String value follows JSON specification. I.e unquoted value that starts with 't' can't be anything else\n\t * than <code>true</code>\n\t * @param jsonValueChar the value\n\t * @return the type of the value\n\t */","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/type/format/StringJsonDocumentReader.java#L206-L242","documentation":"Defensive default arm of the marker switch in next(): it fires only when the parsed StringJsonDocumentMarker has no matching case in the switch. The current enum contains exactly the eight markers that are all handled, so this branch is effectively unreachable through normal parsing; hitting it indicates an internal invariant break (or a Hibernate change that added a marker without a case).","triggerScenarios":"Not reachable via the public API with current enum values; would require corrupted reader state, concurrent misuse of one reader instance, or a patched/newer hibernate-core that introduced an unhandled marker.","commonSituations":"Essentially never seen in the field; if it appears it accompanies a modified hibernate-core build or an upstream regression.","solutions":["Capture the full stack trace and the exact JSON payload that triggered it","Verify the hibernate-core version in the classpath is a coherent release (no mixed jars) and test against the latest patch release","Report to Hibernate JIRA (HHH) with the entity mapping, dialect, and the JSON value"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    results = query.getResultList();\n} catch (IllegalStateException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"unexpected marker [\")) {\n        // internal invariant break: capture payload + hibernate version for a bug report\n        log.error(\"Hibernate JSON reader invariant broken\", e);\n    }\n    throw e;\n}","preventionTips":["Pin one coherent hibernate-core version across the classpath","Run integration tests with representative JSON payloads before upgrading Hibernate","Keep a copy of the failing JSON value for bug reports"],"tags":["hibernate","json","parser","internal-invariant"],"backgroundTag":"json-parse-error","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}