quarkusio/quarkus · error · IllegalArgumentException

At least `STORE` or `STOREDIST` must be set

Error message

At least `STORE` or `STOREDIST` must be set

What it means

GEOSEARCHSTORE-style operations using GeoRadiusStoreArgs must write results somewhere: either STORE (store geo members) or STOREDIST (store distances). If neither store key is configured, toArgs refuses to build a command and throws IllegalArgumentException, because the corresponding Redis command would be invalid/pointless for a storing variant.

Source

Thrown at extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/geo/GeoRadiusStoreArgs.java:136

     * Store the items in a sorted set populated with their distance from the center as a floating point number, in the
     * same unit specified in the radius.
     *
     * @param storeDistKey the storeDistKey value
     * @return the current {@code GeoRadiusStoreArgs}
     **/
    public GeoRadiusStoreArgs<K> storeDistKey(K storeDistKey) {
        this.storeDistKey = storeDistKey;
        return this;
    }

    @Override
    public List<Object> toArgs(Codec codec) {
        // Validation
        if (any && count == -1) {
            throw new IllegalArgumentException("ANY can only be used if COUNT is also set");
        }
        if (storeDistKey == null && storeKey == null) {
            throw new IllegalArgumentException("At least `STORE` or `STOREDIST` must be set");
        }

        List<Object> list = new ArrayList<>();
        if (withDistance) {
            list.add("WITHDIST");
        }
        if (withCoordinates) {
            list.add("WITHCOORD");
        }
        if (withHash) {
            list.add("WITHHASH");
        }

        if (count > 0) {
            list.add("COUNT");
            list.add(Long.toString(count));
        }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Set a store key via the store(...) method before invoking the command
  2. Set a store-distance key via storeDistance(...) if distances should be persisted
  3. Use the non-storing geo args/commands if you only want results returned, not stored

Example fix

// before
GeoRadiusStoreArgs<String> args = GeoRadiusStoreArgs.fromMember("palermo");
geoStore.geoSearchStore("result", "key", args); // throws
// after
GeoRadiusStoreArgs<String> args = GeoRadiusStoreArgs.fromMember("palermo")
    .store("result");
geoStore.geoSearchStore("result", "key", args);
Defensive patterns

Strategy: validation

Validate before calling

if (storeKey == null && storeDistKey == null) { throw new IllegalStateException("geosearchstore needs a store key"); }

Try / catch

try { geo.geoSearchStore(dest, key, args); } catch (IllegalArgumentException e) { log.error("Store key missing: " + e.getMessage()); }

Prevention

When it happens

Trigger: Passing a GeoRadiusStoreArgs instance to a georadiusstore/geosearchstore call where neither storeStoreKey(...) nor storeDist(...) (or equivalent setters for storeKey/storeDistKey) was called.

Common situations: Developer intends a read-only GEORADIUS but uses the store args type; a storeKey setter call was dropped during refactor; args built generically without knowing whether a destination key was supplied.

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 quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/f88f1802aec7d9b6. Report an issue: GitHub.