{"id":"04278c9f6eb9349d","repo":"apache/kafka","slug":"group-id-not-found-groupid","errorCode":null,"errorMessage":"Group ID not found: {groupId}","messagePattern":"Group ID not found: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"clients/src/main/java/org/apache/kafka/clients/admin/ListShareGroupOffsetsResult.java","lineNumber":71,"sourceCode":"                    try {\n                        offsets.put(groupId, future.get());\n                    } catch (InterruptedException | ExecutionException e) {\n                        // This should be unreachable, since the KafkaFuture#allOf already ensured\n                        // that all the futures completed successfully.\n                        throw new RuntimeException(e);\n                    }\n                });\n                return offsets;\n            });\n    }\n\n    /**\n     * Return a future which yields a map of topic partitions to offsets for the specified group. If the group doesn't\n     * have offset information for a specific partition, the corresponding value in the returned map will be null.\n     */\n    public KafkaFuture<Map<TopicPartition, SharePartitionOffsetInfo>> partitionsToOffsetInfo(String groupId) {\n        if (!futures.containsKey(groupId)) {\n            throw new IllegalArgumentException(\"Group ID not found: \" + groupId);\n        }\n        return futures.get(groupId);\n    }\n}\n","sourceCodeStart":53,"sourceCodeEnd":76,"githubUrl":"https://github.com/apache/kafka/blob/c31c9215e131f8c17e79f8901b48c13ee6aa8e7a/clients/src/main/java/org/apache/kafka/clients/admin/ListShareGroupOffsetsResult.java#L53-L76","documentation":"Thrown by ListShareGroupOffsetsResult.partitionsToOffsetInfo(groupId) when the groupId was not among the share groups requested in the original listShareGroupOffsets call. The result object only holds futures for the groups that were requested, so an unknown group is a client-side usage error.","triggerScenarios":"Calling result.partitionsToOffsetInfo(\"sg2\") after Admin.listShareGroupOffsets was called with a Map whose keys did not include \"sg2\". Share groups are a newer group type (KIP-932); the same mismatch pattern as consumer groups applies here.","commonSituations":"Migrating tooling from consumer-group offset listing to share-group offset listing and leaving stale group ids; querying a share group id from config that differs from the one in the request; share group support not enabled on the broker leading to confusion about which ids are valid.","solutions":["Pass a groupId that is one of the keys used in the listShareGroupOffsets request","Use all() to obtain results for every requested share group instead of guessing an id","Verify the share group id source (config/env) matches the one used to build the request map"],"exampleFix":"// before\nListShareGroupOffsetsResult r = admin.listShareGroupOffsets(Map.of(\"sg1\", opts));\nr.partitionsToOffsetInfo(\"sg2\"); // throws\n\n// after\nr.partitionsToOffsetInfo(\"sg1\");","handlingStrategy":"validation","validationCode":"// Track the groupIds given to listShareGroupOffsets and verify before lookup.\nSet<String> requestedGroupIds = new HashSet<>(shareGroupOffsetsRequests.keySet());\nString groupId = ...;\nif (!requestedGroupIds.contains(groupId)) {\n    // this share group was not requested; skip\n    return;\n}\nListShareGroupOffsetsResult result = admin.listShareGroupOffsets(shareGroupOffsetsRequests, options);\nresult.partitionsToOffsetInfo(groupId).get();","typeGuard":"static Optional<String> requestedShareGroup(Set<String> requested, String groupId) {\n    return groupId != null && requested.contains(groupId) ? Optional.of(groupId) : Optional.empty();\n}","tryCatchPattern":"try {\n    result.partitionsToOffsetInfo(groupId).get();\n} catch (IllegalArgumentException e) {\n    // groupId was not among the groups passed to listShareGroupOffsets;\n    // correct the requested set rather than retry.\n    log.warn(\"Share group {} not in listShareGroupOffsets request\", groupId);\n}","preventionTips":["Pass only groupIds you intend to read back, and iterate over that same collection when calling partitionsToOffsetInfo.","Use result.all() if you want every requested share group's offsets in one shot.","Treat absence as a caller bookkeeping bug, not a broker-side retryable condition."],"tags":["kafka","admin-client","share-group","argument-mismatch"],"analyzedSha":"c31c9215e131f8c17e79f8901b48c13ee6aa8e7a","analyzedAt":"2026-08-03T12:34:05.770Z","schemaVersion":2}