{"record":{"id":"f0d5374136103c66","repo":"apache/cassandra","slug":"unhandled-type-type","errorCode":null,"errorMessage":"Unhandled type {type}","messagePattern":"Unhandled type (.+?)","errorType":"validation","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/accord/txn/TxnRead.java","lineNumber":432,"sourceCode":"            if (read.items.length > 0)\n            {\n                out.write(TYPE_NOT_EMPTY);\n                serializeArray(read.items, tablesAndKeys, out, version, TxnNamedRead.serializer);\n                serializeNullable(read.cassandraConsistencyLevel, out, consistencyLevelSerializer);\n            }\n            else\n            {\n                out.write(read.domain == Domain.Key ? TYPE_EMPTY_KEY : TYPE_EMPTY_RANGE);\n            }\n        }\n\n        public void skip(TableMetadatasAndKeys tablesAndKeys, DataInputPlus in, Version version) throws IOException\n        {\n            byte type = in.readByte();\n            switch (type)\n            {\n                default:\n                    throw new IllegalStateException(\"Unhandled type \" + type);\n                case TYPE_EMPTY_KEY:\n                case TYPE_EMPTY_RANGE:\n                    return;\n                case TYPE_NOT_EMPTY:\n                    skipArray(tablesAndKeys, in, version, TxnNamedRead.serializer);\n                    deserializeNullable(in, consistencyLevelSerializer);\n            }\n        }\n\n\n        @Override\n        public TxnRead deserialize(TableMetadatasAndKeys tablesAndKeys, DataInputPlus in, Version version) throws IOException\n        {\n            byte type = in.readByte();\n            switch (type)\n            {\n                default:\n                    throw new IllegalStateException(\"Unhandled type \" + type);","sourceCodeStart":414,"sourceCodeEnd":450,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/accord/txn/TxnRead.java#L414-L450","documentation":"The TxnRead.serializer's skip() reads a one-byte type tag from the wire and dispatches on it. Only TYPE_EMPTY_KEY, TYPE_EMPTY_RANGE and TYPE_NOT_EMPTY are valid; any other byte means the stream is corrupt or was written by an incompatible serializer version, so an IllegalStateException is thrown.","triggerScenarios":"Deserializing (skipping over) a TxnRead whose first byte is not one of the defined type constants — corrupt wire data, wrong serializer version, or misaligned read position in the input stream.","commonSituations":"Mixed-version cluster during upgrade where serialization formats differ; message corruption; a bug in a peer writing the type byte; manually crafted or fuzzed inter-node payloads.","solutions":["Verify all nodes run a compatible Cassandra version (serialization format skew)","Check for stream corruption / message framing bugs upstream of this deserializer","Add a case for the unexpected type byte if a new type constant was intentionally introduced","Enable tracing on inter-node messaging to find the sender producing bad payloads"],"exampleFix":"// before\ndefault:\n    throw new IllegalStateException(\"Unhandled type \" + type);\n// after\ncase TYPE_NOT_EMPTY_V2:\n    skipArray(tablesAndKeys, in, version, TxnNamedRead.v2Serializer);\n    return;\ndefault:\n    throw new IllegalStateException(\"Unhandled type \" + type);","handlingStrategy":"try-catch","validationCode":"byte type = peekTypeByte(payload);\nif (type != TYPE_EMPTY_KEY && type != TYPE_EMPTY_RANGE && type != TYPE_NOT_EMPTY)\n    throw new IOException(\"Corrupt TxnRead type tag: \" + type);","typeGuard":null,"tryCatchPattern":"try { serializer.skip(tablesAndKeys, in, version); }\ncatch (IllegalStateException e) { throw new IOException(\"Corrupt or version-skewed TxnRead payload\", e); }","preventionTips":["Keep cluster versions homogeneous or follow supported upgrade paths","Log the offending byte and node pair to detect the sender producing bad frames","Gate new serialization tags behind inter-node messaging versions"],"tags":["accord","serialization","corrupt-data"],"backgroundTag":"unexpected-response-shape","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}