{"record":{"id":"d5ce9257f519ab9c","repo":"apache/flink","slug":"unsupported-byte-value-for-row-kind","errorCode":null,"errorMessage":"Unsupported byte value '{}' for row kind.","messagePattern":"Unsupported byte value '(.+?)' for row kind\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/types/RowKind.java","lineNumber":117,"sourceCode":"\n    /**\n     * Creates a {@link RowKind} from the given byte value. Each {@link RowKind} has a byte value\n     * representation.\n     *\n     * @see #toByteValue() for mapping of byte value and {@link RowKind}.\n     */\n    public static RowKind fromByteValue(byte value) {\n        switch (value) {\n            case 0:\n                return INSERT;\n            case 1:\n                return UPDATE_BEFORE;\n            case 2:\n                return UPDATE_AFTER;\n            case 3:\n                return DELETE;\n            default:\n                throw new UnsupportedOperationException(\n                        \"Unsupported byte value '\" + value + \"' for row kind.\");\n        }\n    }\n}\n","sourceCodeStart":99,"sourceCodeEnd":122,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/types/RowKind.java#L99-L122","documentation":"RowKind is an enum of the four change types in Flink's changelog semantics (INSERT=0, UPDATE_BEFORE=1, UPDATE_AFTER=2, DELETE=3). fromByteValue(byte) maps a serialized byte back to the enum; any value outside 0..3 has no representation and throws UnsupportedOperationException.","triggerScenarios":"Calling RowKind.fromByteValue(b) with b not in {0,1,2,3}; typically during deserialization of a Row's kind byte from a byte buffer, e.g. RowSerializer reading a row kind written by a different or corrupt serializer.","commonSituations":"Reading changelog-encoded rows produced by a newer/other system that uses extra kind values; corrupted byte buffers (offset drift reading a non-kind byte as the kind); custom serializers that reused the byte for flags.","solutions":["Verify the byte stream alignment: the kind byte must be read at the exact offset the writer used","Pre-validate: if (value < 0 || value > 3) reject the record before deserialization","If you control the wire format, map custom kind values to the four canonical kinds before encoding"],"exampleFix":"// before\nRowKind kind = RowKind.fromByteValue(buffer.readByte()); // 0x07 from corrupt stream\n\n// after\nbyte raw = buffer.readByte();\nif (raw < 0 || raw > 3) {\n    throw new IOException(\"Corrupt row kind byte: \" + raw);\n}\nRowKind kind = RowKind.fromByteValue(raw);","handlingStrategy":"validation","validationCode":"byte raw = source.readByte();\nif (raw < 0 || raw > 3) {\n    throw new IOException(\"Invalid RowKind byte \" + raw + \" — stream likely corrupt or misaligned\");\n}\nRowKind kind = RowKind.fromByteValue(raw);","typeGuard":"static boolean isValidRowKindByte(byte b) {\n    return b >= 0 && b <= 3;\n}","tryCatchPattern":"catch (UnsupportedOperationException e) { throw new IOException(\"Corrupt row kind byte\", e); }","preventionTips":["Keep writer/reader serializer versions aligned","Validate kind bytes when parsing external data","Treat out-of-range kind bytes as corruption, not a retryable error"],"tags":["flink","row-kind","deserialization","unsupported-operation","changelog"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}