{"record":{"id":"7925a569d0754fa4","repo":"hibernate/hibernate-orm","slug":"unrecognized-marker","errorCode":null,"errorMessage":"Unrecognized marker: {}","messagePattern":"Unrecognized marker: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/type/format/StringJsonDocumentReader.java","lineNumber":210,"sourceCode":"\t\t\t\t\t\t\tthrow new IllegalStateException( \"unexpected quote read 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\tcase KEY_VALUE_SEPARATOR:  // that's the start of an attribute value\n\t\t\t\t\t//assert this.processingStates.getCurrent() == JsonProcessingState.OBJECT_KEY_NAME;\n\t\t\t\t\t// flush the OBJECT_KEY_NAME\n\t\t\t\t\t//this.processingStates.pop();\n\t\t\t\t\tbreak;\n\t\t\t\tcase SEPARATOR:\n\t\t\t\t\t// unless we are processing an array, following SEPARATOR that will a key\n\t\t\t\t\tbreak;\n\t\t\t\tcase OTHER:\n\t\t\t\t\t// here we are in front of a boolean, a null or a numeric value.\n\t\t\t\t\t// if none of these cases we're going to raise IllegalStateException\n\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}","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/type/format/StringJsonDocumentReader.java#L192-L228","documentation":"In the OTHER-marker branch, consumeNonStringValue() scans the unquoted literal (expected to be true, false, null or a number) and returns -1 when it reaches the end of input without ever hitting a delimiter (whitespace or a structural marker like } ] , :). The reader then reports the character at the current position as an 'Unrecognized marker'. In practice the JSON is truncated in the middle of (or right after) a bare value, or has garbage trailing characters.","triggerScenarios":"Documents like {\"a\": tru (literal cut off at end of input), [123 (bare number running to the limit), or {\"a\":1}xyz where trailing non-marker text extends to the end of the string so no delimiter is ever found.","commonSituations":"Column value truncated by an ETL/transport layer or manual editing; a VARCHAR column too short for the JSON so it was silently cut; another writer appending diagnostics text after the JSON; reading a partially-written value because the writer had no transactional protection.","solutions":["Retrieve the full failing column value and check its tail for truncation or appended garbage; repair it","Widen the column / fix the producer so complete JSON is stored","Validate on write with a strict parser so truncated values never reach the database","Catch IllegalStateException during bulk reads to quarantine bad rows"],"exampleFix":"-- before: value truncated by a too-narrow column ('{\"a\": tru')\nALTER TABLE entity_table ALTER COLUMN json_col TYPE text;\nUPDATE entity_table SET json_col = '{\"a\": true}';\n-- after: complete document stored","handlingStrategy":"try-catch","validationCode":"static void assertCompleteJson(String candidate) {\n    try {\n        new com.fasterxml.jackson.databind.ObjectMapper().readTree(candidate);\n    } catch (Exception e) {\n        throw new IllegalArgumentException(\"Refusing to store truncated/invalid JSON: \" + e.getMessage(), e);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    results = query.getResultList();\n} catch (IllegalStateException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Unrecognized marker\")) {\n        logQuarantineRow(e); // isolate the bad row instead of failing the whole load\n        return List.of();\n    }\n    throw e;\n}","preventionTips":["Size JSON columns generously (text/jsonb, not narrow varchar)","Validate with a strict parser before every write to the column","Write JSON within the same transaction as the owning row so partial values never become visible"],"tags":["hibernate","json","parser","truncated-input","malformed-data"],"backgroundTag":"json-parse-error","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}