{"record":{"id":"b641d77e898f401f","repo":"apache/cassandra","slug":"corrupted-input-expected-byte-1-2-3-4-5-or-6","errorCode":null,"errorMessage":"Corrupted input: expected byte 1, 2, 3, 4, 5 or 6; received ","messagePattern":"Corrupted input: expected byte 1, 2, 3, 4, 5 or 6; received ","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/accord/serializers/KeySerializers.java","lineNumber":366,"sourceCode":"                    out.writeByte(5);\n                    partialRangeRoute.serializeSubset((PartialRangeRoute)t, superset, out);\n                    break;\n                case FullRangeRoute:\n                    out.writeByte(6);\n                    fullRangeRoute.serializeSubset((FullRangeRoute)t, superset, out);\n                    break;\n            }\n        }\n\n        @Override\n        public RS deserialize(DataInputPlus in) throws IOException\n        {\n            byte b = in.readByte();\n            UnseekablesKind kind;\n            RS result;\n            switch (b)\n            {\n                default: throw new IOException(\"Corrupted input: expected byte 1, 2, 3, 4, 5 or 6; received \" + b);\n                case 1: kind = UnseekablesKind.RoutingKeys; result = (RS)routingKeys.deserialize(in); break;\n                case 2: kind = UnseekablesKind.PartialKeyRoute; result = (RS)partialKeyRoute.deserialize(in); break;\n                case 3: kind = UnseekablesKind.FullKeyRoute; result = (RS)fullKeyRoute.deserialize(in); break;\n                case 4: kind = UnseekablesKind.RoutingRanges; result = (RS)ranges.deserialize(in); break;\n                case 5: kind = UnseekablesKind.PartialRangeRoute; result = (RS)partialRangeRoute.deserialize(in); break;\n                case 6: kind = UnseekablesKind.FullRangeRoute; result = (RS)fullRangeRoute.deserialize(in); break;\n            }\n            Invariants.require(permitted.contains(kind));\n            return result;\n        }\n\n        public RS deserializeSubset(Unseekables<?> superset, DataInputPlus in) throws IOException\n        {\n            byte b = in.readByte();\n            UnseekablesKind kind;\n            RS result;\n            switch (b)\n            {","sourceCodeStart":348,"sourceCodeEnd":384,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/accord/serializers/KeySerializers.java#L348-L384","documentation":"The Unseekables serializer reads a kind byte and dispatches to one of six sub-serializers (RoutingKeys through FullRangeRoute, bytes 1-6). Any other byte throws IOException because the stream does not represent a valid serialized Unseekables. Causes are corruption, truncation/misalignment, or a peer encoding kinds this version does not know.","triggerScenarios":"deserialize(DataInputPlus) reads a byte not in 1..6 while decoding an Unseekables/Route object, e.g. during Accord command/message deserialization.","commonSituations":"Version skew during rolling upgrades; corrupted network payload; stream misaligned by a prior deserialization bug; synthetic test data with a bad tag.","solutions":["Confirm cluster nodes run compatible versions so the UnseekablesKind encoding matches (finish rolling upgrade).","Log the received byte and cross-check against UnseekablesKind values to identify the mismatched encoder.","Look for earlier exceptions on the same connection that may have desynchronized the stream; reset the session.","If a new kind was added, update this serializer's switch and the documented byte range in the message."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    Unseekables<?, ?> u = UnseekablesSerializer.deserialize(in, version);\n} catch (IOException e) {\n    if (e.getMessage().startsWith(\"Corrupted input\")) {\n        logger.warn(\"Corrupt Unseekables payload; discarding and resetting stream\", e);\n        // drop message / close connection to resynchronize\n    } else throw e;\n}","preventionTips":["Complete rolling upgrades before mixing Accord message versions.","Treat any deserialization exception on a stream as fatal for that connection's alignment.","Add fuzz tests that feed random tag bytes to all Accord serializers."],"tags":["serialization","deserialization","accord","corrupted-input"],"backgroundTag":"invalid-enum-value","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}