{"record":{"id":"fd362edf8ac16592","repo":"redis/jedis","slug":"filter-arguments-must-be-set","errorCode":null,"errorMessage":"FILTER arguments must be set.","messagePattern":"FILTER arguments must be set\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/main/java/redis/clients/jedis/timeseries/TSMRangeParams.java","lineNumber":247,"sourceCode":"    return this;\n  }\n\n  public TSMRangeParams filter(String... filters) {\n    this.filters = filters;\n    return this;\n  }\n\n  public TSMRangeParams groupBy(String label, String reduce) {\n    this.groupByLabel = label;\n    this.groupByReduce = reduce;\n    return this;\n  }\n\n  @Override\n  public void addParams(CommandArguments args) {\n\n    if (filters == null) {\n      throw new IllegalArgumentException(\"FILTER arguments must be set.\");\n    }\n\n    if (excludeEmpty && groupByLabel != null && groupByReduce != null) {\n      throw new IllegalArgumentException(\"EXCLUDEEMPTY is not allowed with GROUPBY.\");\n    }\n\n    if (fromTimestamp == null) {\n      args.add(MINUS);\n    } else {\n      args.add(toByteArray(fromTimestamp));\n    }\n\n    if (toTimestamp == null) {\n      args.add(PLUS);\n    } else {\n      args.add(toByteArray(toTimestamp));\n    }\n","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/redis/jedis/blob/6dac31d4c224fb3257c216f3985340c6f500cdcb/src/main/java/redis/clients/jedis/timeseries/TSMRangeParams.java#L229-L265","documentation":"TSMRangeParams.addParams(CommandArguments) serializes the parameters into the TS.MRANGE/TS.MREVRANGE command. A multi-key time-series range query is meaningless without a FILTER clause, so if filters was never set (addFilter never called), it throws IllegalArgumentException(\"FILTER arguments must be set.\") at command-build time rather than sending a broken command to Redis.","triggerScenarios":"Executing ts.mrange(params...) with a TSMRangeParams built without calling addFilter(...), e.g. new TSMRangeParams(from, to).aggregation(...) followed directly by the query call.","commonSituations":"Copy-pasting single-key TS.RANGE param construction (which needs no filter) for the multi-key MRANGE API; building params dynamically where the filter-adding branch is skipped because the filter list is empty; migration from TSMGET-style calls.","solutions":["Call addFilter before executing, e.g. params.addFilter(QueryBuilders.equal(\"sensor\", \"temp\")), or use the withFilters style API.","If no filter is applicable, use the single-key TS.RANGE (TSRangeParams) API instead of MRANGE.","Add a pre-execution check that filters were configured whenever MRANGE is used, with a clear error for the caller."],"exampleFix":"// before\nTSMRangeParams p = new TSMRangeParams(0, System.currentTimeMillis());\njedis.ts.mrange(p); // throws: no FILTER\n// after\nTSMRangeParams p = new TSMRangeParams(0, System.currentTimeMillis())\n    .addFilter(new Filters().equals(\"sensor\", \"temp\"));\njedis.ts.mrange(p);","handlingStrategy":"validation","validationCode":"Objects.requireNonNull(filters, \"TS.MRANGE requires at least one FILTER; call addFilter before executing\");\njedis.ts.mrange(params);","typeGuard":"boolean readyForMrange(TSMRangeParams p) {\n  return p != null; // and ensure addFilter was called; track it in your builder wrapper\n}","tryCatchPattern":"try {\n  Map<String, TSMRangeResult> r = jedis.ts.mrange(params);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"FILTER\")) {\n    throw new IllegalStateException(\"Multi-key range queries need filters; use TSRangeParams for single-key queries\");\n  }\n  throw e;\n}","preventionTips":["Always pair TSMRangeParams with at least one addFilter call.","Wrap multi-key query construction in a helper that enforces filter presence.","Use TSRangeParams (single-key) when no filter is needed."],"tags":["java","timeseries","validation","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"}