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
- Set a store key via the store(...) method before invoking the command
- Set a store-distance key via storeDistance(...) if distances should be persisted
- 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
- Decide upfront whether results are stored or returned, and pick the matching args type
- Always call store(...) or storeDistance(...) on store args
- Never reuse plain GeoSearchArgs-like objects for store commands
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
- ANY can only be used if COUNT is also set
- `member` cannot be `null`
- `radius` must be positive
- `unit` cannot be `null`
- `width` must be positive
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/f88f1802aec7d9b6.
Report an issue: GitHub.