{"record":{"id":"e1dc4c663a545ef5","repo":"apache/kafka","slug":"unknown-acknowledge-type-id-id","errorCode":null,"errorMessage":"Unknown acknowledge type id: {id}","messagePattern":"Unknown acknowledge type id: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"clients/src/main/java/org/apache/kafka/clients/consumer/AcknowledgeType.java","lineNumber":72,"sourceCode":"    /**\n     * Returns the AcknowledgeType for the given identifier.\n     *\n     * @param id The identifier for the acknowledge type\n     * @return The corresponding AcknowledgeType\n     * @throws IllegalArgumentException If the ID is not recognized\n     */\n    public static AcknowledgeType forId(byte id) {\n        switch (id) {\n            case 1:\n                return ACCEPT;\n            case 2:\n                return RELEASE;\n            case 3:\n                return REJECT;\n            case 4:\n                return RENEW;\n            default:\n                throw new IllegalArgumentException(\"Unknown acknowledge type id: \" + id);\n        }\n    }\n}\n","sourceCodeStart":54,"sourceCodeEnd":76,"githubUrl":"https://github.com/apache/kafka/blob/996fb4585aa1bcc8980b0e1b8d6b168b986cd979/clients/src/main/java/org/apache/kafka/clients/consumer/AcknowledgeType.java#L54-L76","documentation":"Thrown by AcknowledgeType.forId(byte) when the id does not match ACCEPT(1), RELEASE(2), REJECT(3), or RENEW(4). AcknowledgeType enumerates the acknowledgment outcomes a share-group consumer can return when acknowledging fetched records. An unknown id means the client received an unexpected value during (de)serialization of share-group acknowledgment messages.","triggerScenarios":"Calling AcknowledgeType.forId with a byte other than 1-4; receiving a share-group acknowledgment response from a broker using a new acknowledge type unknown to this client.","commonSituations":"Client older than broker during a rolling upgrade of share-group support; corrupt acknowledgment payload; misuse of the API by passing a raw byte from elsewhere.","solutions":["Upgrade kafka-clients to a version supporting the new acknowledge type.","Verify you are passing a value produced by the library (or one of the documented constants), not a hand-coded byte.","Catch IllegalArgumentException around share-group acknowledge calls and report the unsupported id."],"exampleFix":"// before\nAcknowledgeType t = AcknowledgeType.forId(rawByte);\n\n// after\ntry {\n    AcknowledgeType t = AcknowledgeType.forId(rawByte);\n} catch (IllegalArgumentException e) {\n    throw new IllegalStateException(\"Unsupported acknowledge id \" + rawByte + \"; upgrade kafka-clients\", e);\n}","handlingStrategy":"try-catch","validationCode":"// Validate against known ids before calling forId\nif (rawByte < 1 || rawByte > 4) {\n    throw new IllegalArgumentException(\"Unsupported acknowledge id \" + rawByte);\n}\nAcknowledgeType.forId(rawByte);","typeGuard":"static boolean isKnownAcknowledgeId(byte id) {\n    return id >= 1 && id <= 4;\n}","tryCatchPattern":"try {\n    type = AcknowledgeType.forId(rawByte);\n} catch (IllegalArgumentException e) {\n    throw new IllegalStateException(\"Unsupported acknowledge id; upgrade kafka-clients\", e);\n}","preventionTips":["Always pass AcknowledgeType enum values produced by the library, not hand-coded bytes.","Keep the client at or above the broker version when using share groups.","Add integration coverage for share-group acknowledge across versions."],"tags":["consumer","share-group","wire-protocol","illegal-argument","version-mismatch"],"backgroundTag":null,"analyzedSha":"996fb4585aa1bcc8980b0e1b8d6b168b986cd979","analyzedAt":"2026-08-11T22:03:28.655Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}