apache/kafka · error · SchemaException
Unsupported assignment version: {}
Error message
Unsupported assignment version: {} What it means
Thrown by ConsumerProtocol.checkAssignmentVersion() when the supplied assignment version is below ConsumerProtocolAssignment.LOWEST_SUPPORTED_VERSION. Older assignment wire formats are not supported; newer ones are accepted and silently capped to HIGHEST_SUPPORTED_VERSION, so this fires only for versions that predate the supported floor.
Source
Thrown at clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerProtocol.java:226
}
}
public static ConsumerProtocolAssignment deserializeConsumerProtocolAssignment(final ByteBuffer buffer) {
return deserializeConsumerProtocolAssignment(buffer, deserializeVersion(buffer));
}
private static short checkSubscriptionVersion(final short version) {
if (version < ConsumerProtocolSubscription.LOWEST_SUPPORTED_VERSION)
throw new SchemaException("Unsupported subscription version: " + version);
else if (version > ConsumerProtocolSubscription.HIGHEST_SUPPORTED_VERSION)
return ConsumerProtocolSubscription.HIGHEST_SUPPORTED_VERSION;
else
return version;
}
private static short checkAssignmentVersion(final short version) {
if (version < ConsumerProtocolAssignment.LOWEST_SUPPORTED_VERSION)
throw new SchemaException("Unsupported assignment version: " + version);
else if (version > ConsumerProtocolAssignment.HIGHEST_SUPPORTED_VERSION)
return ConsumerProtocolAssignment.HIGHEST_SUPPORTED_VERSION;
else
return version;
}
}
View on GitHub (pinned to c31c9215e1)
Solutions
- Print the offending version to determine whether it is a true legacy value or the symptom of corrupted/zeroed header bytes.
- Read old snapshots with a Kafka version contemporaneous with the data; do not force-cross LOWEST_SUPPORTED_VERSION.
- If the version came from the wire, check that the SyncGroup response was not truncated or replaced with garbage (look for BufferUnderflowException-adjacent logs).
- Re-serialize via ConsumerProtocol.serializeAssignment(assignment) with no explicit version to pick up the current floor/ceiling.
Example fix
// before ConsumerProtocol.serializeAssignment(a, (short) 0); // after ConsumerProtocol.serializeAssignment(a); // picks HIGHEST_SUPPORTED_VERSION
Defensive patterns
Strategy: validation
Validate before calling
import org.apache.kafka.common.message.ConsumerProtocolAssignment;
static short ensureSupportedAssignmentVersion(short version) {
if (version < ConsumerProtocolAssignment.LOWEST_SUPPORTED_VERSION)
throw new IllegalArgumentException(
"assignment version " + version + " below lowest supported "
+ ConsumerProtocolAssignment.LOWEST_SUPPORTED_VERSION);
return (short) Math.min(version, ConsumerProtocolAssignment.HIGHEST_SUPPORTED_VERSION);
} Type guard
static boolean isSupportedAssignmentVersion(short v) {
return v >= ConsumerProtocolAssignment.LOWEST_SUPPORTED_VERSION
&& v <= ConsumerProtocolAssignment.HIGHEST_SUPPORTED_VERSION;
} Try / catch
try {
ConsumerProtocol.serializeAssignment(assignment, version);
} catch (org.apache.kafka.common.protocol.types.SchemaException e) {
log.error("Unsupported consumer protocol assignment version", e);
throw e;
} Prevention
- Let ConsumerProtocol.serializeAssignment() pick HIGHEST_SUPPORTED_VERSION unless you have a specific cross-version reason.
- Keep assignment and subscription versions identical across the group — the static initializer in ConsumerProtocol asserts they share LOWEST/HIGHEST ranges.
- Validate the version against ConsumerProtocolAssignment bounds before any serialize/deserialize call to fail with a clear message rather than a SchemaException.
When it happens
Trigger: Calling ConsumerProtocol.serializeAssignment, deserializeAssignment, or deserializeConsumerProtocolAssignment with an explicit version below LOWEST_SUPPORTED_VERSION. Most often seen when a corrupted assignment header deserializes to version 0, or when custom code passes a stale hardcoded version constant.
Common situations: Persisted group-state snapshots from a much older Kafka being read by a current client; truncated/zeroed assignment bytes producing version 0; custom assignor hardcoding a version literal that has since been retired.
Related errors
- Malformed consumer protocol assignment
- Unsupported subscription version: {}
- Buffer underflow while parsing consumer protocol's header
- Malformed consumer protocol subscription
- Buffer underflow while parsing response for request with hea
AI-assisted analysis of apache/kafka@c31c9215e1 (2026-08-03).
Data as JSON: /data/errors/6191a98cbf66ecad.json.
Report an issue: GitHub.