{"record":{"id":"56e5c619adaaed83","repo":"redis/jedis","slug":"start-end-and-count-must-be-set","errorCode":null,"errorMessage":"start, end and count must be set.","messagePattern":"start, end and count must be set\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/main/java/redis/clients/jedis/params/XPendingParams.java","lineNumber":93,"sourceCode":"  public XPendingParams count(int count) {\n    this.count = count;\n    return this;\n  }\n\n  public XPendingParams consumer(String consumer) {\n    this.consumer = from(consumer);\n    return this;\n  }\n\n  public XPendingParams consumer(byte[] consumer) {\n    this.consumer = from(consumer);\n    return this;\n  }\n\n  @Override\n  public void addParams(CommandArguments args) {\n    if (count == null) {\n      throw new IllegalArgumentException(\"start, end and count must be set.\");\n    }\n    if (start == null) start = from(\"-\");\n    if (end == null) end = from(\"+\");\n\n    if (idle != null) {\n      args.add(Keyword.IDLE).add(idle);\n    }\n\n    args.add(start).add(end).add(count);\n\n    if (consumer != null) {\n      args.add(consumer);\n    }\n  }\n\n  @Override\n  public boolean equals(Object o) {\n    if (this == o) return true;","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/redis/jedis/blob/6dac31d4c224fb3257c216f3985340c6f500cdcb/src/main/java/redis/clients/jedis/params/XPendingParams.java#L75-L111","documentation":"XPendingParams.addParams() serializes XPENDING options and requires count to have been set; Jedis throws this IllegalArgumentException when count is null because the Redis XPENDING extended form requires a COUNT argument, with START/END defaulting to the full range if absent.","triggerScenarios":"Calling XPendingParams with an idle filter or consumer but never calling count(n), then passing it to xpending(range, params) / xpending(key, group, params).","commonSituations":"Building XPendingParams to filter by idle time or consumer name assuming start/end/count are optional; forgetting that count is mandatory even when defaults for start/end are auto-filled.","solutions":["Call .count(n) on the XPendingParams, e.g. new XPendingParams().count(10).","Use the simpler xpending overload or XPendingParams.count(start, end, count) helper so all three are set.","Set start/end explicitly too if you need a bounded range rather than the implicit ('-', '+') defaults."],"exampleFix":"// before\nXPendingParams params = new XPendingParams().idle(60000);\njedis.xpending(\"mystream\", \"mygroup\", params);\n// after\nXPendingParams params = new XPendingParams().idle(60000).count(10);\njedis.xpending(\"mystream\", \"mygroup\", params);","handlingStrategy":"validation","validationCode":"XPendingParams params = new XPendingParams();\nif (paramsGetCount(params) == null) params = new XPendingParams().count(10); // always set count before use","typeGuard":null,"tryCatchPattern":"try {\n  return jedis.xpending(stream, group, params);\n} catch (IllegalArgumentException e) {\n  return jedis.xpending(stream, group, new XPendingParams().count(10));\n}","preventionTips":["Always chain .count(n) when building XPendingParams.","Prefer XPendingParams.count(start, end, count) which sets all required fields.","Wrap XPendingParams construction in a helper factory so callers can't forget count."],"tags":["jedis","params","redis-streams","missing-argument"],"backgroundTag":"missing-required-argument","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"}