{"record":{"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/996fb4585aa1bcc8980b0e1b8d6b168b986cd979/clients/src/main/java/org/apache/kafka/clients/admin/ListShareGroupOffsetsResult.java#L53-L76","documentation":"An IllegalArgumentException thrown by ListShareGroupOffsetsResult.partitionsToOffsetInfo(groupId) when the supplied share-group groupId was not among the groups requested in the original listShareGroupOffsets call. The result only carries futures for the groups you asked about.","triggerScenarios":"Calling Admin.listShareGroupOffsets with a collection of groups, then calling result.partitionsToOffsetInfo(groupId) for a group not in that collection. Case/whitespace mismatch between the requested and queried group ids.","commonSituations":"Building the requested set from one source and querying from another; typos or trailing whitespace in group ids; reusing a stale id after the requested set changed.","solutions":["Only query for groupIds you passed into the listShareGroupOffsets request.","Keep the requested collection in a variable and iterate it when reading per-group results.","Trim/normalize groupId strings before both requesting and querying."],"exampleFix":"// before\nListShareGroupOffsetsResult r = admin.listShareGroupOffsets(Set.of(\"sg1\",\"sg2\"));\nr.partitionsToOffsetInfo(\"sg3\"); // not requested\n\n// after\nr.partitionsToOffsetInfo(\"sg1\");","handlingStrategy":"validation","validationCode":"Set<String> requested = Set.copyOf(shareGroupIds);\nListShareGroupOffsetsResult r = admin.listShareGroupOffsets(requested);\nfor (String g : requested) r.partitionsToOffsetInfo(g);","typeGuard":"static boolean wasRequested(String groupId, Set<String> requested) {\n    return requested.contains(groupId);\n}","tryCatchPattern":null,"preventionTips":["Iterate the exact collection you passed into listShareGroupOffsets.","Trim/normalize group ids before requesting and querying."],"tags":["kafka-admin","share-groups","offsets","argument-validation","client-side"],"backgroundTag":null,"analyzedSha":"996fb4585aa1bcc8980b0e1b8d6b168b986cd979","analyzedAt":"2026-08-11T22:03:28.655Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}