apache/pulsar · error · IllegalArgumentException
Invalid interval '%d'.
Error message
Invalid interval '%d'.
What it means
The SetDeduplicationSnapshotInterval command validates that the required --interval parameter is non-negative before calling setDeduplicationSnapshotInterval. A negative value throws IllegalArgumentException with the invalid value formatted into the message; the documented valid range is 0 to Integer.MAX_VALUE.
Source
Thrown at pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopics.java:1823
void run() throws PulsarAdminException {
String persistentTopic = validatePersistentTopic(topicName);
print(getTopics().getDeduplicationSnapshotInterval(persistentTopic));
}
}
@Command(description = "Set deduplication snapshot interval for a topic", hidden = true)
private class SetDeduplicationSnapshotInterval extends CliCommand {
@Parameters(description = "persistent://tenant/namespace/topic", arity = "1")
private String topicName;
@Option(names = { "-i", "--interval" }, description = "Deduplication snapshot interval for topic in second, "
+ "allowed range from 0 to Integer.MAX_VALUE", required = true)
private int interval;
@Override
void run() throws PulsarAdminException {
if (interval < 0) {
throw new IllegalArgumentException(String.format("Invalid interval '%d'. ", interval));
}
String persistentTopic = validatePersistentTopic(topicName);
getTopics().setDeduplicationSnapshotInterval(persistentTopic, interval);
}
}
@Command(description = "Remove deduplication snapshot interval for a topic", hidden = true)
private class RemoveDeduplicationSnapshotInterval extends CliCommand {
@Parameters(description = "persistent://tenant/namespace/topic", arity = "1")
private String topicName;
@Override
void run() throws PulsarAdminException {
String persistentTopic = validatePersistentTopic(topicName);
getTopics().removeDeduplicationSnapshotInterval(persistentTopic);
}View on GitHub (pinned to 820761864e)
Solutions
- Pass a non-negative interval, e.g. `--interval 1000` (milliseconds).
- Use 0 to effectively disable deduplication snapshotting rather than a negative number.
- To unset the policy entirely, use the remove-deduplication-snapshot-interval command instead of a negative value.
Example fix
// before bin/pulsar-admin topics set-deduplication-snapshot-interval my-topic --interval -1 // after bin/pulsar-admin topics set-deduplication-snapshot-interval my-topic --interval 1000
Defensive patterns
Strategy: validation
Validate before calling
// validate before invoking INTERVAL=$((INTERVAL + 0)) if [ "$INTERVAL" -lt 0 ]; then echo "interval must be >= 0"; exit 1; fi bin/pulsar-admin topics set-deduplication-snapshot-interval "$TOPIC" --interval "$INTERVAL"
Prevention
- Clamp computed intervals to >= 0 before calling the CLI.
- Remember 0 is the valid 'disabled' value, not a negative number.
- Use remove commands to clear policies rather than negative sentinels.
When it happens
Trigger: Running `pulsar-admin topics set-deduplication-snapshot-interval <topic> --interval -N` where N > 0.
Common situations: Deriving the interval from a config value or subtraction that goes negative; typo like `--interval -1` while intending to unset the value.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Need to provide a persistent topic name
- Need to provide a non-persistent topic name
- Invalid message id (must be in format: ledgerId:entryId) val
- unable to parse namespaces parameter list:
- unable to parse primary parameter list:
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/71fbcfb2ba90c804.
Report an issue: GitHub.