{"id":"6191a98cbf66ecad","repo":"apache/kafka","slug":"unsupported-assignment-version","errorCode":null,"errorMessage":"Unsupported assignment version: {}","messagePattern":"Unsupported assignment version: (.+?)","errorType":"exception","errorClass":"SchemaException","httpStatus":null,"severity":"error","filePath":"clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerProtocol.java","lineNumber":226,"sourceCode":"        }\n    }\n\n    public static ConsumerProtocolAssignment deserializeConsumerProtocolAssignment(final ByteBuffer buffer) {\n        return deserializeConsumerProtocolAssignment(buffer, deserializeVersion(buffer));\n    }\n\n    private static short checkSubscriptionVersion(final short version) {\n        if (version < ConsumerProtocolSubscription.LOWEST_SUPPORTED_VERSION)\n            throw new SchemaException(\"Unsupported subscription version: \" + version);\n        else if (version > ConsumerProtocolSubscription.HIGHEST_SUPPORTED_VERSION)\n            return ConsumerProtocolSubscription.HIGHEST_SUPPORTED_VERSION;\n        else\n            return version;\n    }\n\n    private static short checkAssignmentVersion(final short version) {\n        if (version < ConsumerProtocolAssignment.LOWEST_SUPPORTED_VERSION)\n            throw new SchemaException(\"Unsupported assignment version: \" + version);\n        else if (version > ConsumerProtocolAssignment.HIGHEST_SUPPORTED_VERSION)\n            return ConsumerProtocolAssignment.HIGHEST_SUPPORTED_VERSION;\n        else\n            return version;\n    }\n}\n","sourceCodeStart":208,"sourceCodeEnd":233,"githubUrl":"https://github.com/apache/kafka/blob/c31c9215e131f8c17e79f8901b48c13ee6aa8e7a/clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerProtocol.java#L208-L233","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nConsumerProtocol.serializeAssignment(a, (short) 0);\n\n// after\nConsumerProtocol.serializeAssignment(a); // picks HIGHEST_SUPPORTED_VERSION","handlingStrategy":"validation","validationCode":"import org.apache.kafka.common.message.ConsumerProtocolAssignment;\n\nstatic short ensureSupportedAssignmentVersion(short version) {\n    if (version < ConsumerProtocolAssignment.LOWEST_SUPPORTED_VERSION)\n        throw new IllegalArgumentException(\n            \"assignment version \" + version + \" below lowest supported \"\n            + ConsumerProtocolAssignment.LOWEST_SUPPORTED_VERSION);\n    return (short) Math.min(version, ConsumerProtocolAssignment.HIGHEST_SUPPORTED_VERSION);\n}","typeGuard":"static boolean isSupportedAssignmentVersion(short v) {\n    return v >= ConsumerProtocolAssignment.LOWEST_SUPPORTED_VERSION\n        && v <= ConsumerProtocolAssignment.HIGHEST_SUPPORTED_VERSION;\n}","tryCatchPattern":"try {\n    ConsumerProtocol.serializeAssignment(assignment, version);\n} catch (org.apache.kafka.common.protocol.types.SchemaException e) {\n    log.error(\"Unsupported consumer protocol assignment version\", e);\n    throw e;\n}","preventionTips":["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."],"tags":["consumer","protocol","version","schema","assignment"],"analyzedSha":"c31c9215e131f8c17e79f8901b48c13ee6aa8e7a","analyzedAt":"2026-08-03T12:34:05.770Z","schemaVersion":2}