{"record":{"id":"c4d50356fb6b9fa1","repo":"redis/jedis","slug":"georadiusstoreparam-must-has-store-or-storedist-op","errorCode":null,"errorMessage":"GeoRadiusStoreParam must has store or storedist option","messagePattern":"GeoRadiusStoreParam must has store or storedist option","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/main/java/redis/clients/jedis/params/GeoRadiusStoreParam.java","lineNumber":47,"sourceCode":"    return this;\n  }\n\n  public GeoRadiusStoreParam storeDist(String key) {\n    if (key != null) {\n      this.storeDist = true;\n      this.key = key;\n    }\n    return this;\n  }\n\n  @Override\n  public void addParams(CommandArguments args) {\n    if (storeDist) {\n      args.add(Keyword.STOREDIST).key(key);\n    } else if (store) {\n      args.add(Keyword.STORE).key(key);\n    } else {\n      throw new IllegalArgumentException(this.getClass().getSimpleName()\n          + \" must has store or storedist option\");\n    }\n  }\n}\n","sourceCodeStart":29,"sourceCodeEnd":52,"githubUrl":"https://github.com/redis/jedis/blob/6dac31d4c224fb3257c216f3985340c6f500cdcb/src/main/java/redis/clients/jedis/params/GeoRadiusStoreParam.java#L29-L52","documentation":"GeoRadiusStoreParam is the parameter object for GEORADIUS with a STORE/STOREDIST option. The library requires that one of the two store options be set before the params are serialized into the command arguments; if neither store nor storeDist was configured, addParams() throws this IllegalArgumentException instead of sending an invalid command to Redis. It is a client-side fail-fast validation of a required option.","triggerScenarios":"Calling GEORADIUS with a GeoRadiusStoreParam instance created via GeoRadiusStoreParam() (or an empty instance) that never had storeStoreParam(key) or storeDistStoreParam(key) applied, then passing it to georadius(..., params) so addParams() runs.","commonSituations":"Dynamically building store params where the store key is computed at runtime and ends up null/skipped; refactoring code that dropped the .storeStoreParam(...) builder call; copying example code that only shows the store variant while the dev wants a plain GEORADIUS and mistakenly passes an empty store param object.","solutions":["Call .storeStoreParam(key) (STORE) or .storeDistStoreParam(key) (STOREDIST) on the GeoRadiusStoreParam before passing it to georadius()","If you do not want to store results at all, do not pass a GeoRadiusStoreParam — use georadius(...) without the store param","If the store key is computed dynamically, assert it is non-null before building params"],"exampleFix":"// before\nGeoRadiusStoreParam storeParam = new GeoRadiusStoreParam();\njedis.georadius(key, lon, lat, 100, GeoUnit.KM, param, storeParam);\n// after\nGeoRadiusStoreParam storeParam = new GeoRadiusStoreParam().storeDistStoreParam(\"dest:key\");\njedis.georadius(key, lon, lat, 100, GeoUnit.KM, param, storeParam);","handlingStrategy":"validation","validationCode":"if (storeParam == null || !storeParam.isStoreSet() && !storeParam.isStoreDistSet()) {\n  throw new IllegalStateException(\"GeoRadiusStoreParam requires storeStoreParam(key) or storeDistStoreParam(key)\");\n}","typeGuard":"boolean hasStoreOption(GeoRadiusStoreParam p) { return p != null && (p.isStoreSet() || p.isStoreDistSet()); }","tryCatchPattern":"try {\n  jedis.georadius(key, lon, lat, r, GeoUnit.KM, param, storeParam);\n} catch (IllegalArgumentException e) {\n  // fall back to plain georadius without store, or rebuild params with a store key\n}","preventionTips":["Always chain storeStoreParam/storeDistStoreParam immediately when creating GeoRadiusStoreParam","Do not pass a store param object when no STORE option is wanted","Assert dynamic store keys are non-null before building params"],"tags":["jedis","georadius","parameter-validation","illegal-argument"],"backgroundTag":"missing-required-option","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"}