redis/jedis · error · IllegalArgumentException

IDMP-MAXSIZE must be between 1 and 10000

Error message

IDMP-MAXSIZE must be between 1 and 10000

What it means

XCfgSetParams.idmpMaxsize() validates the stream IDMP-MAXSIZE setting client-side; Redis allows 1 to 10000 idempotent IDs per producer. Jedis throws this IllegalArgumentException for values outside that range before any command is sent.

Solutions

  1. Pass a maxsize between 1 and 10000, e.g. idmpMaxsize(1000).
  2. Omit the idmpMaxsize() call to keep the server default.
  3. Clamp the configured value: Math.max(1, Math.min(10000, maxsize)).

Example fix

// before
XCfgSetParams params = XCfgSetParams.xCfgSetParams().idmpMaxsize(0);
// after
XCfgSetParams params = XCfgSetParams.xCfgSetParams().idmpMaxsize(10000);
Defensive patterns

Strategy: validation

Validate before calling

if (maxsize < 1 || maxsize > 10000) throw new IllegalArgumentException("IDMP-MAXSIZE must be in [1, 10000], got " + maxsize);

Type guard

boolean isValidIdmpMaxsize(int size) { return size >= 1 && size <= 10000; }

Try / catch

try {
  params = XCfgSetParams.xCfgSetParams().idmpMaxsize(cfg.getMaxsize());
} catch (IllegalArgumentException e) {
  log.warn("Invalid IDMP-MAXSIZE, using default", e);
  params = XCfgSetParams.xCfgSetParams();
}

Prevention

When it happens

Trigger: Calling XCfgSetParams.xCfgSetParams().idmpMaxsize(n) with n < 1 or n > 10000, e.g. idmpMaxsize(0) or idmpMaxsize(50000).

Common situations: Attempting to disable the IDMP table by passing 0 instead of not setting it; sizing the table from an unconstrained user config; confusing maxsize with a byte/KB size.

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


AI-assisted analysis of redis/jedis@6dac31d4c2 (2026-09-08). Data as JSON: /api/errors/5e15479b9371c120. Report an issue: GitHub.

Appendix: source

Thrown at src/main/java/redis/clients/jedis/params/XCfgSetParams.java:44

   */
  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;
  }

  @Override
  public void addParams(CommandArguments args) {
    if (idmpDuration != null) {
      args.add("IDMP-DURATION").add(idmpDuration);
    }
    if (idmpMaxsize != null) {
      args.add("IDMP-MAXSIZE").add(idmpMaxsize);
    }
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;

View on GitHub (pinned to 6dac31d4c2)