{"record":{"id":"354b9fdae7b55b28","repo":"apache/kafka","slug":"topic-topic-was-not-included-in-the-original-req","errorCode":null,"errorMessage":"Topic {topic} was not included in the original request","messagePattern":"Topic (.+?) was not included in the original request","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"clients/src/main/java/org/apache/kafka/clients/admin/DeleteShareGroupOffsetsResult.java","lineNumber":68,"sourceCode":"                result.completeExceptionally(throwable);\n            } else {\n                for (String topic : topics) {\n                    if (maybeCompleteExceptionally(topicResults, topic, result)) {\n                        return;\n                    }\n                }\n                result.complete(null);\n            }\n        });\n        return result;\n    }\n\n    /**\n     * Return a future which can be used to check the result for a given topic.\n     */\n    public KafkaFuture<Void> topicResult(final String topic) {\n        if (!topics.contains(topic)) {\n            throw new IllegalArgumentException(\"Topic \" + topic + \" was not included in the original request\");\n        }\n        final KafkaFutureImpl<Void> result = new KafkaFutureImpl<>();\n\n        this.future.whenComplete((topicResults, throwable) -> {\n            if (throwable != null) {\n                result.completeExceptionally(throwable);\n            } else if (!maybeCompleteExceptionally(topicResults, topic, result)) {\n                result.complete(null);\n            }\n        });\n        return result;\n    }\n\n    private boolean maybeCompleteExceptionally(Map<String, ApiException> topicLevelErrors,\n                                               String topic,\n                                               KafkaFutureImpl<Void> result) {\n        Throwable exception;\n        if (!topicLevelErrors.containsKey(topic)) {","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/apache/kafka/blob/996fb4585aa1bcc8980b0e1b8d6b168b986cd979/clients/src/main/java/org/apache/kafka/clients/admin/DeleteShareGroupOffsetsResult.java#L50-L86","documentation":"Thrown by DeleteShareGroupOffsetsResult.topicResult() when the requested topic String was not in the set passed to the original Admin.deleteShareGroupOffsets call. Mirrors the consumer-group equivalent but for share groups, guarding per-topic future lookup.","triggerScenarios":"Calling topicResult(topic) where topic is not contained in the topics set captured during construction of DeleteShareGroupOffsetsResult.","commonSituations":"Querying a topic that was not part of the original delete request, or a string mismatch (e.g. trailing whitespace, case difference) between the request and the lookup.","solutions":["Only call topicResult with topic names that were in the original deleteShareGroupOffsets request.","Keep a reference to the original topic set and validate membership first.","Trim/normalize topic strings to avoid whitespace or encoding mismatches."],"exampleFix":"// before\nresult.topicResult(\"orders \"); // trailing space, not in request\n\n// after\nif (requestedTopics.contains(topic.trim())) {\n    result.topicResult(topic.trim());\n}","handlingStrategy":"validation","validationCode":"Set<String> requested = ...; // from original deleteShareGroupOffsets call\nif (!requested.contains(topic)) {\n    throw new IllegalArgumentException(topic + \" not in original request\");\n}\nresult.topicResult(topic);","typeGuard":"boolean wasRequested(Set<String> requested, String topic) {\n    return requested.contains(topic);\n}","tryCatchPattern":null,"preventionTips":["Keep the original topic set and validate membership before topicResult.","Normalize topic strings (trim) consistently between request and lookup.","Use the all() future when you need every result without per-topic guards."],"tags":["validation","admin","share-group"],"backgroundTag":null,"analyzedSha":"996fb4585aa1bcc8980b0e1b8d6b168b986cd979","analyzedAt":"2026-08-11T22:03:28.655Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}