redis/jedis · error · IllegalArgumentException

GeoRadiusStoreParam must has store or storedist option

Error message

GeoRadiusStoreParam must has store or storedist option

What it means

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.

Solutions

  1. Call .storeStoreParam(key) (STORE) or .storeDistStoreParam(key) (STOREDIST) on the GeoRadiusStoreParam before passing it to georadius()
  2. If you do not want to store results at all, do not pass a GeoRadiusStoreParam — use georadius(...) without the store param
  3. If the store key is computed dynamically, assert it is non-null before building params

Example fix

// before
GeoRadiusStoreParam storeParam = new GeoRadiusStoreParam();
jedis.georadius(key, lon, lat, 100, GeoUnit.KM, param, storeParam);
// after
GeoRadiusStoreParam storeParam = new GeoRadiusStoreParam().storeDistStoreParam("dest:key");
jedis.georadius(key, lon, lat, 100, GeoUnit.KM, param, storeParam);
Defensive patterns

Strategy: validation

Validate before calling

if (storeParam == null || !storeParam.isStoreSet() && !storeParam.isStoreDistSet()) {
  throw new IllegalStateException("GeoRadiusStoreParam requires storeStoreParam(key) or storeDistStoreParam(key)");
}

Type guard

boolean hasStoreOption(GeoRadiusStoreParam p) { return p != null && (p.isStoreSet() || p.isStoreDistSet()); }

Try / catch

try {
  jedis.georadius(key, lon, lat, r, GeoUnit.KM, param, storeParam);
} catch (IllegalArgumentException e) {
  // fall back to plain georadius without store, or rebuild params with a store key
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Must pass :limit option" / "Missing required option" — required option errors explained — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at src/main/java/redis/clients/jedis/params/GeoRadiusStoreParam.java:47

    return this;
  }

  public GeoRadiusStoreParam storeDist(String key) {
    if (key != null) {
      this.storeDist = true;
      this.key = key;
    }
    return this;
  }

  @Override
  public void addParams(CommandArguments args) {
    if (storeDist) {
      args.add(Keyword.STOREDIST).key(key);
    } else if (store) {
      args.add(Keyword.STORE).key(key);
    } else {
      throw new IllegalArgumentException(this.getClass().getSimpleName()
          + " must has store or storedist option");
    }
  }
}

View on GitHub (pinned to 6dac31d4c2)