{"record":{"id":"5fa0f79121496a39","repo":"apache/kafka","slug":"unknown-rebalance-protocol-id-id","errorCode":null,"errorMessage":"Unknown rebalance protocol id: {id}","messagePattern":"Unknown rebalance protocol id: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerPartitionAssignor.java","lineNumber":409,"sourceCode":"        public byte id() {\n            return id;\n        }\n\n        /**\n         * Returns the rebalance protocol for the given identifier.\n         *\n         * @param id The identifier for the rebalance protocol\n         * @return The corresponding rebalance protocol\n         * @throws IllegalArgumentException If the ID is not recognized\n         */\n        public static RebalanceProtocol forId(byte id) {\n            switch (id) {\n                case 0:\n                    return EAGER;\n                case 1:\n                    return COOPERATIVE;\n                default:\n                    throw new IllegalArgumentException(\"Unknown rebalance protocol id: \" + id);\n            }\n        }\n    }\n\n    /**\n     * Get a list of configured instances of {@link org.apache.kafka.clients.consumer.ConsumerPartitionAssignor}\n     * based on the class names/types specified by {@link org.apache.kafka.clients.consumer.ConsumerConfig#PARTITION_ASSIGNMENT_STRATEGY_CONFIG}\n     */\n    static List<ConsumerPartitionAssignor> getAssignorInstances(List<String> assignorClasses, Map<String, Object> configs) {\n        List<ConsumerPartitionAssignor> assignors = new ArrayList<>();\n        // a map to store assignor name -> assignor class name\n        Map<String, String> assignorNameMap = new HashMap<>();\n\n        for (Object klass : assignorClasses) {\n            // first try to get the class if passed in as a string\n            if (klass instanceof String) {\n                try {\n                    klass = Utils.loadClass((String) klass, Object.class);","sourceCodeStart":391,"sourceCodeEnd":427,"githubUrl":"https://github.com/apache/kafka/blob/996fb4585aa1bcc8980b0e1b8d6b168b986cd979/clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerPartitionAssignor.java#L391-L427","documentation":"Thrown by ConsumerPartitionAssignor.RebalanceProtocol.forId(byte) when the id is not 0 (EAGER) or 1 (COOPERATIVE). The enum is used when decoding the rebalance protocol carried over the wire (e.g. in SyncGroup/Heartbeat responses). An unknown id means the broker/assignor produced a protocol value this client does not recognize.","triggerScenarios":"Calling RebalanceProtocol.forId with a byte other than 0 or 1; deserializing a protocol message from a newer broker that added a new rebalance protocol.","commonSituations":"Client older than broker; experimental protocol extension; corrupt wire data.","solutions":["Upgrade kafka-clients to match the broker version.","Restrict the API versions negotiated with the broker to those the client supports.","Catch IllegalArgumentException and treat the response as unsupported for this client."],"exampleFix":"// before\nRebalanceProtocol p = RebalanceProtocol.forId(rawId);\n\n// after\nRebalanceProtocol p;\ntry {\n    p = RebalanceProtocol.forId(rawId);\n} catch (IllegalArgumentException e) {\n    throw new IllegalStateException(\"Unsupported rebalance protocol id \" + rawId + \"; upgrade kafka-clients\", e);\n}","handlingStrategy":"try-catch","validationCode":"// Pre-validate against known ids\nif (rawId != 0 && rawId != 1) {\n    throw new IllegalArgumentException(\"Unsupported rebalance protocol id \" + rawId);\n}\nConsumerPartitionAssignor.RebalanceProtocol.forId(rawId);","typeGuard":"static boolean isKnownRebalanceProtocolId(byte id) {\n    return id == 0 || id == 1;\n}","tryCatchPattern":"try {\n    protocol = ConsumerPartitionAssignor.RebalanceProtocol.forId(rawId);\n} catch (IllegalArgumentException e) {\n    throw new IllegalStateException(\"Unsupported rebalance protocol id \" + rawId + \"; upgrade kafka-clients\", e);\n}","preventionTips":["Keep client and broker versions aligned.","Restrict negotiated API versions on the broker to those the client supports.","Surface unknown-wire-id failures as version-mismatch diagnostics."],"tags":["consumer","wire-protocol","illegal-argument","version-mismatch","rebalance"],"backgroundTag":null,"analyzedSha":"996fb4585aa1bcc8980b0e1b8d6b168b986cd979","analyzedAt":"2026-08-11T22:03:28.655Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}