quarkusio/quarkus · error · IllegalArgumentException
FROMMEMBER and FROMLONLAT cannot be used together
Error message
FROMMEMBER and FROMLONLAT cannot be used together
What it means
GeoSearchStoreArgs.toArgs() validates that the GEOSEARCHSTORE origin is set exactly once: either FROMMEMBER or FROMLONLAT. If both a member and lon/lat coordinates were set, the library throws IllegalArgumentException because Redis accepts only one origin.
Source
Thrown at extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/geo/GeoSearchStoreArgs.java:160
**/
public GeoSearchStoreArgs<V> any() {
this.any = true;
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 (radius > 0 && width > 0) {
throw new IllegalArgumentException("BYRADIUS and BYBOX cannot be used together");
}
if (member != null && (latitude != Double.MIN_VALUE || longitude != Double.MIN_VALUE)) {
throw new IllegalArgumentException("FROMMEMBER and FROMLONLAT cannot be used together");
}
List<Object> list = new ArrayList<>();
if (member != null) {
list.add("FROMMEMBER");
list.add(new String(codec.encode(member), StandardCharsets.UTF_8));
} else {
list.add("FROMLONLAT");
list.add(Double.toString(longitude));
list.add(Double.toString(latitude));
}
if (radius > 0) {
list.add("BYRADIUS");
list.add(Double.toString(radius));
list.add(unit.toString());
} else {
list.add("BYBOX");View on GitHub (pinned to e1c734241f)
Solutions
- Set only one origin: fromMember or fromLonLat, not both
- Instantiate a new GeoSearchStoreArgs per query instead of reusing
- Audit the build path to find and delete the second origin call
Example fix
// before
GeoSearchStoreArgs<String> args = GeoSearchStoreArgs.fromMember("palermo").fromLonLat(13.36, 38.11);
// after
GeoSearchStoreArgs<String> args = GeoSearchStoreArgs.fromMember("palermo"); Defensive patterns
Strategy: validation
Validate before calling
if (member != null && center != null) {
throw new IllegalStateException("Choose either fromMember or fromLonLat, not both");
} Try / catch
try {
geoSearchStore(key, dest, args);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("FROMMEMBER and FROMLONLAT")) {
args = rebuildArgsWithSingleOrigin();
geoSearchStore(key, dest, args);
} else throw e;
} Prevention
- Model the origin as a sealed choice (either member or coordinates) so only one can be set
- Build a new GeoSearchStoreArgs per query; never reuse builders
- Add unit tests for each origin mode and the mixed case
When it happens
Trigger: Calling both fromMember(...) and fromLonLat(...) (or fromCoordinates) on the same GeoSearchStoreArgs instance before executing the store command.
Common situations: Reused/cached builders across requests; conditional logic where both origin-setting branches execute; migrating code from member-based to coordinate-based search without removing the member call.
Related errors
- BYRADIUS and BYBOX cannot be used together
- FROMMEMBER and FROMLONLAT cannot be used together
- `member` cannot be `null`
- `radius` must be positive
- `unit` cannot be `null`
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/5d9461e28ac7688c.
Report an issue: GitHub.