{"record":{"id":"ed14d88170dd0a29","repo":"redis/jedis","slug":"idmp-duration-must-be-between-1-and-86400-seconds","errorCode":null,"errorMessage":"IDMP-DURATION must be between 1 and 86400 seconds","messagePattern":"IDMP-DURATION must be between 1 and 86400 seconds","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/main/java/redis/clients/jedis/params/XCfgSetParams.java","lineNumber":29,"sourceCode":"public class XCfgSetParams implements IParams {\n\n  private Integer idmpDuration;\n  private Integer idmpMaxsize;\n\n  public static XCfgSetParams xCfgSetParams() {\n    return new XCfgSetParams();\n  }\n\n  /**\n   * Set the duration (in seconds) that Redis keeps each idempotent ID. Minimum value: 1 second;\n   * Maximum value: 86400 seconds (24h); default value: 100 seconds.\n   * @param duration duration in seconds (1-86400)\n   * @return XCfgSetParams\n   * @throws IllegalArgumentException if duration is not between 1 and 86400\n   */\n  public XCfgSetParams idmpDuration(int duration) {\n    if (duration < 1 || duration > 86400) {\n      throw new IllegalArgumentException(\"IDMP-DURATION must be between 1 and 86400 seconds\");\n    }\n    this.idmpDuration = duration;\n    return this;\n  }\n\n  /**\n   * Set the maximum number of most recent idempotent IDs that Redis keeps for each producer ID.\n   * Minimum value: 1; Maximum value: 10000; default value: 100.\n   * @param maxsize maximum number of idempotent IDs per producer (1-10000)\n   * @return XCfgSetParams\n   * @throws IllegalArgumentException if maxsize is not between 1 and 10000\n   */\n  public XCfgSetParams idmpMaxsize(int maxsize) {\n    if (maxsize < 1 || maxsize > 10000) {\n      throw new IllegalArgumentException(\"IDMP-MAXSIZE must be between 1 and 10000\");\n    }\n    this.idmpMaxsize = maxsize;\n    return this;","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/redis/jedis/blob/6dac31d4c224fb3257c216f3985340c6f500cdcb/src/main/java/redis/clients/jedis/params/XCfgSetParams.java#L11-L47","documentation":"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.","triggerScenarios":"Calling XCfgSetParams.xCfgSetParams().idmpDuration(n) with n < 1 or n > 86400, e.g. idmpDuration(0) to try to disable idempotence or idmpDuration(100000).","commonSituations":"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.","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]."],"exampleFix":"// before\nXCfgSetParams params = XCfgSetParams.xCfgSetParams().idmpDuration(0);\n// after\nXCfgSetParams params = XCfgSetParams.xCfgSetParams().idmpDuration(3600);","handlingStrategy":"validation","validationCode":"if (duration < 1 || duration > 86400) throw new IllegalArgumentException(\"IDMP-DURATION must be in [1, 86400] seconds, got \" + duration);","typeGuard":"boolean isValidIdmpDuration(int seconds) { return seconds >= 1 && seconds <= 86400; }","tryCatchPattern":"try {\n  params = XCfgSetParams.xCfgSetParams().idmpDuration(cfg.getDurationSeconds());\n} catch (IllegalArgumentException e) {\n  log.warn(\"Invalid IDMP-DURATION, using default\", e);\n  params = XCfgSetParams.xCfgSetParams();\n}","preventionTips":["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."],"tags":["jedis","params","validation","redis-streams"],"backgroundTag":"value-out-of-range","analyzedSha":"6dac31d4c224fb3257c216f3985340c6f500cdcb","analyzedAt":"2026-09-08T04:55:01.204Z","contentChangedAt":"2026-09-08T04:55:01.204Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}