apache/cassandra · error · IOException
Corrupted input: expected byte 1, 2, 3, 4, 5 or 6; received
Error message
Corrupted input: expected byte 1, 2, 3, 4, 5 or 6; received
What it means
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.
Source
Thrown at src/java/org/apache/cassandra/service/accord/serializers/KeySerializers.java:366
out.writeByte(5);
partialRangeRoute.serializeSubset((PartialRangeRoute)t, superset, out);
break;
case FullRangeRoute:
out.writeByte(6);
fullRangeRoute.serializeSubset((FullRangeRoute)t, superset, out);
break;
}
}
@Override
public RS deserialize(DataInputPlus in) throws IOException
{
byte b = in.readByte();
UnseekablesKind kind;
RS result;
switch (b)
{
default: throw new IOException("Corrupted input: expected byte 1, 2, 3, 4, 5 or 6; received " + b);
case 1: kind = UnseekablesKind.RoutingKeys; result = (RS)routingKeys.deserialize(in); break;
case 2: kind = UnseekablesKind.PartialKeyRoute; result = (RS)partialKeyRoute.deserialize(in); break;
case 3: kind = UnseekablesKind.FullKeyRoute; result = (RS)fullKeyRoute.deserialize(in); break;
case 4: kind = UnseekablesKind.RoutingRanges; result = (RS)ranges.deserialize(in); break;
case 5: kind = UnseekablesKind.PartialRangeRoute; result = (RS)partialRangeRoute.deserialize(in); break;
case 6: kind = UnseekablesKind.FullRangeRoute; result = (RS)fullRangeRoute.deserialize(in); break;
}
Invariants.require(permitted.contains(kind));
return result;
}
public RS deserializeSubset(Unseekables<?> superset, DataInputPlus in) throws IOException
{
byte b = in.readByte();
UnseekablesKind kind;
RS result;
switch (b)
{View on GitHub (pinned to 88fd0f6a0e)
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.
Defensive patterns
Strategy: try-catch
Try / catch
try {
Unseekables<?, ?> u = UnseekablesSerializer.deserialize(in, version);
} catch (IOException e) {
if (e.getMessage().startsWith("Corrupted input")) {
logger.warn("Corrupt Unseekables payload; discarding and resetting stream", e);
// drop message / close connection to resynchronize
} else throw e;
} Prevention
- 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.
When it happens
Trigger: deserialize(DataInputPlus) reads a byte not in 1..6 while decoding an Unseekables/Route object, e.g. during Accord command/message deserialization.
Common situations: Version skew during rolling upgrades; corrupted network payload; stream misaligned by a prior deserialization bug; synthetic test data with a bad tag.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Corrupted input: expected byte 1, 2, 3, 4 or 5; received
- Unhandled CheckStatusReply kind:
- Corrupted input: expected byte 1 or 2, received " + b
- Invalid 64-bits double value, expecting 8 bytes but got
- Invalid 32-bits float value, expecting 4 bytes but got
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/b641d77e898f401f.
Report an issue: GitHub.