apache/kafka · error · IllegalArgumentException
Topic was not included in the original request
Error message
Topic {topic} was not included in the original request What it means
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.
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.
Example fix
// before
result.topicResult("orders "); // trailing space, not in request
// after
if (requestedTopics.contains(topic.trim())) {
result.topicResult(topic.trim());
} Defensive patterns
Strategy: validation
Validate before calling
Set<String> requested = ...; // from original deleteShareGroupOffsets call
if (!requested.contains(topic)) {
throw new IllegalArgumentException(topic + " not in original request");
}
result.topicResult(topic); Type guard
boolean wasRequested(Set<String> requested, String topic) {
return requested.contains(topic);
} Prevention
- 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.
When it happens
Trigger: Calling topicResult(topic) where topic is not contained in the topics set captured during construction of DeleteShareGroupOffsetsResult.
Common situations: 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.
Related errors
- Partition was not included in the original request
- Topic partition was not included in the request
- topicIdFutures and nameFutures cannot both be null.
- topicIdFutures and nameFutures cannot both be null.
- topicIdFutures and nameFutures cannot both be specified.
AI-assisted analysis of apache/kafka@996fb4585a (2026-08-11).
Data as JSON: /api/errors/354b9fdae7b55b28.
Report an issue: GitHub.
Appendix: source
Thrown at clients/src/main/java/org/apache/kafka/clients/admin/DeleteShareGroupOffsetsResult.java:68
result.completeExceptionally(throwable);
} else {
for (String topic : topics) {
if (maybeCompleteExceptionally(topicResults, topic, result)) {
return;
}
}
result.complete(null);
}
});
return result;
}
/**
* Return a future which can be used to check the result for a given topic.
*/
public KafkaFuture<Void> topicResult(final String topic) {
if (!topics.contains(topic)) {
throw new IllegalArgumentException("Topic " + topic + " was not included in the original request");
}
final KafkaFutureImpl<Void> result = new KafkaFutureImpl<>();
this.future.whenComplete((topicResults, throwable) -> {
if (throwable != null) {
result.completeExceptionally(throwable);
} else if (!maybeCompleteExceptionally(topicResults, topic, result)) {
result.complete(null);
}
});
return result;
}
private boolean maybeCompleteExceptionally(Map<String, ApiException> topicLevelErrors,
String topic,
KafkaFutureImpl<Void> result) {
Throwable exception;
if (!topicLevelErrors.containsKey(topic)) {View on GitHub (pinned to 996fb4585a)