redis/jedis · error · IllegalArgumentException
IDMP-DURATION must be between 1 and 86400 seconds
Error message
IDMP-DURATION must be between 1 and 86400 seconds
What it means
XCfgSetParams.idmpDuration() validates the stream IDMP-DURATION setting client-side; Redis requires it to be between 1 and 86400 seconds. Jedis throws this IllegalArgumentException immediately instead of letting the server reject an out-of-range XCFGSET call.
Solutions
- Pass a duration between 1 and 86400 seconds, e.g. idmpDuration(3600).
- Omit the idmpDuration() call if you meant to disable or leave the default idempotence duration.
- Convert your configured value to seconds and clamp into [1, 86400].
Example fix
// before XCfgSetParams params = XCfgSetParams.xCfgSetParams().idmpDuration(0); // after XCfgSetParams params = XCfgSetParams.xCfgSetParams().idmpDuration(3600);
Defensive patterns
Strategy: validation
Validate before calling
if (duration < 1 || duration > 86400) throw new IllegalArgumentException("IDMP-DURATION must be in [1, 86400] seconds, got " + duration); Type guard
boolean isValidIdmpDuration(int seconds) { return seconds >= 1 && seconds <= 86400; } Try / catch
try {
params = XCfgSetParams.xCfgSetParams().idmpDuration(cfg.getDurationSeconds());
} catch (IllegalArgumentException e) {
log.warn("Invalid IDMP-DURATION, using default", e);
params = XCfgSetParams.xCfgSetParams();
} Prevention
- Store the duration in seconds in config with a documented range.
- Clamp: Math.max(1, Math.min(86400, seconds)).
- Don't pass 0 to 'disable' — omit the option instead.
When it happens
Trigger: Calling XCfgSetParams.xCfgSetParams().idmpDuration(n) with n < 1 or n > 86400, e.g. idmpDuration(0) to try to disable idempotence or idmpDuration(100000).
Common situations: Trying to disable IDMP by passing 0 instead of omitting the option; confusing milliseconds with seconds; copying a TTL value in days/hours without converting to seconds.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- IDMP-MAXSIZE must be between 1 and 10000
- LIMIT must be non-negative
- start, end and count must be set.
- client info cannot contain spaces, newlines or special…
- DriverInfo must not be null
AI-assisted analysis of redis/jedis@6dac31d4c2 (2026-09-08).
Data as JSON: /api/errors/ed14d88170dd0a29.
Report an issue: GitHub.
Appendix: source
Thrown at src/main/java/redis/clients/jedis/params/XCfgSetParams.java:29
public class XCfgSetParams implements IParams {
private Integer idmpDuration;
private Integer idmpMaxsize;
public static XCfgSetParams xCfgSetParams() {
return new XCfgSetParams();
}
/**
* Set the duration (in seconds) that Redis keeps each idempotent ID. Minimum value: 1 second;
* Maximum value: 86400 seconds (24h); default value: 100 seconds.
* @param duration duration in seconds (1-86400)
* @return XCfgSetParams
* @throws IllegalArgumentException if duration is not between 1 and 86400
*/
public XCfgSetParams idmpDuration(int duration) {
if (duration < 1 || duration > 86400) {
throw new IllegalArgumentException("IDMP-DURATION must be between 1 and 86400 seconds");
}
this.idmpDuration = duration;
return this;
}
/**
* Set the maximum number of most recent idempotent IDs that Redis keeps for each producer ID.
* Minimum value: 1; Maximum value: 10000; default value: 100.
* @param maxsize maximum number of idempotent IDs per producer (1-10000)
* @return XCfgSetParams
* @throws IllegalArgumentException if maxsize is not between 1 and 10000
*/
public XCfgSetParams idmpMaxsize(int maxsize) {
if (maxsize < 1 || maxsize > 10000) {
throw new IllegalArgumentException("IDMP-MAXSIZE must be between 1 and 10000");
}
this.idmpMaxsize = maxsize;
return this;View on GitHub (pinned to 6dac31d4c2)