{"record":{"id":"fe57f4927ac85396","repo":"hibernate/hibernate-orm","slug":"unknown-oson-event","errorCode":null,"errorMessage":"Unknown OSON event: {}","messagePattern":"Unknown OSON event: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/type/format/OsonDocumentReader.java","lineNumber":102,"sourceCode":"\t\t\t\tcurrentValue = Boolean.FALSE;\n\t\t\t\treturn JsonDocumentItemType.BOOLEAN_VALUE;\n\t\t\tcase VALUE_NULL:\n\t\t\t\tcurrentValue = null;\n\t\t\t\treturn JsonDocumentItemType.NULL_VALUE;\n\t\t\tcase VALUE_DECIMAL:\n\t\t\t\tcurrentValue = this.parser.getBigDecimal();\n\t\t\t\treturn JsonDocumentItemType.VALUE;\n\t\t\tcase VALUE_DOUBLE:\n\t\t\t\tcurrentValue = this.parser.getDouble();\n\t\t\t\treturn JsonDocumentItemType.VALUE;\n\t\t\tcase VALUE_FLOAT:\n\t\t\t\tcurrentValue = this.parser.getFloat();\n\t\t\t\treturn JsonDocumentItemType.VALUE;\n\t\t\tcase VALUE_BINARY:\n\t\t\t\tcurrentValue = this.parser.getBytes();\n\t\t\t\treturn JsonDocumentItemType.VALUE;\n\t\t\tdefault :\n\t\t\t\tthrow new IllegalStateException( \"Unknown OSON event: \" + evt );\n\t\t}\n\t}\n\n\t@Override\n\tpublic String getObjectKeyName() {\n\t\tif (currentKeyName == null)\n\t\t\tthrow new IllegalStateException(\"no object key available\");\n\t\treturn currentKeyName;\n\t}\n\n\t@Override\n\tpublic String getStringValue() {\n\t\treturn (String)currentValue;\n\t}\n\n\t@Override\n\tpublic BigDecimal getBigDecimalValue() {\n\t\treturn (BigDecimal)currentValue;","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/type/format/OsonDocumentReader.java#L84-L120","documentation":"OsonDocumentReader.next() maps OracleJsonParser.Event values to JsonDocumentItemType: object/array tokens, KEY_NAME, string, true/false, null, decimal, double, float, binary, and the date/timestamp/interval events (VALUE_TIMESTAMPTZ, VALUE_DATE, VALUE_TIMESTAMP, VALUE_INTERVALDS, VALUE_INTERVALYM). Any other OSON event reaches the default branch and throws IllegalStateException 'Unknown OSON event: ' + evt.","triggerScenarios":"Parsing an Oracle OSON document containing a native scalar kind the switch does not map - depending on the ojdbc version, e.g. VALUE_INTEGER, VALUE_TIME or VALUE_RAW emitted for documents written by other Oracle tooling (SODA, SQL inserts with native types).","commonSituations":"Oracle JSON documents produced outside Hibernate; ojdbc version differences changing the event stream; mixing OSON writers; early Hibernate builds of the OSON reader before event coverage was complete.","solutions":["Rewrite the documents so the problematic fields are stored as JSON strings/timestamps the reader maps","Upgrade Hibernate ORM and ojdbc - event coverage increases over time","Avoid the OSON path for that mapping (configure the String-based JSON format mapper) and report the unmapped event to Hibernate with a document reproducer"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"null","typeGuard":null,"tryCatchPattern":"try {\n    T value = mapper.readFromSource(javaType, parser, options);\n} catch (IllegalStateException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Unknown OSON event\")) {\n        // document contains a native scalar kind this reader cannot map; flag the row\n        throw new DataIntegrityViolationException(\"Unsupported native JSON value in document\", e);\n    }\n    throw e;\n}","preventionTips":["Write JSON documents through Hibernate itself so only mapped scalar kinds appear","Keep ojdbc and Hibernate versions in lockstep; event coverage changes between builds","Avoid native Oracle date/time/raw JSON scalars in documents Hibernate will read"],"tags":["hibernate","oracle","oson","json","parser","jdbc-driver"],"backgroundTag":"json-parser-unknown-event","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}