{"record":{"id":"b0a37a885a61aeb9","repo":"quarkusio/quarkus","slug":"frommember-and-fromlonlat-cannot-be-used-together","errorCode":null,"errorMessage":"FROMMEMBER and FROMLONLAT cannot be used together","messagePattern":"FROMMEMBER and FROMLONLAT cannot be used together","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/geo/GeoSearchArgs.java","lineNumber":198,"sourceCode":"     **/\n    public GeoSearchArgs<V> any() {\n        this.any = true;\n        return this;\n    }\n\n    @Override\n    public List<Object> toArgs(Codec codec) {\n        // Validation\n        if (any && count == -1) {\n            throw new IllegalArgumentException(\"ANY can only be used if COUNT is also set\");\n        }\n\n        if (radius > 0 && width > 0) {\n            throw new IllegalArgumentException(\"BYRADIUS and BYBOX cannot be used together\");\n        }\n\n        if (member != null && (latitude != Double.MIN_VALUE || longitude != Double.MIN_VALUE)) {\n            throw new IllegalArgumentException(\"FROMMEMBER and FROMLONLAT cannot be used together\");\n        }\n\n        List<Object> list = new ArrayList<>();\n        if (member != null) {\n            list.add(\"FROMMEMBER\");\n            list.add(new String(codec.encode(member), StandardCharsets.UTF_8));\n        } else {\n            list.add(\"FROMLONLAT\");\n            list.add(Double.toString(longitude));\n            list.add(Double.toString(latitude));\n        }\n\n        if (radius > 0) {\n            list.add(\"BYRADIUS\");\n            list.add(Double.toString(radius));\n            list.add(unit.toString());\n        } else {\n            list.add(\"BYBOX\");","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/geo/GeoSearchArgs.java#L180-L216","documentation":"GeoSearchArgs.toArgs() validates that a GEOSEARCH origin is specified exactly once. If both a member (FROMMEMBER) and coordinates (FROMLONLAT) were set on the args builder, the library throws IllegalArgumentException because the Redis GEOSEARCH command accepts only one origin. It is a fail-fast misuse check, not a runtime failure.","triggerScenarios":"Calling GeoSearchArgs methods that set both origin types on the same builder instance, e.g. chaining fromMember(m) and fromLonLat(lon, lat) (or reusing a builder that already had one origin set and adding the other) before executing a geosearch.","commonSituations":"Reusing a cached/shared GeoSearchArgs object across calls; building args conditionally where both branches run; copying settings from another args object without clearing the previous origin.","solutions":["Use only one origin: call either fromMember(...) or fromLonLat(...), never both on the same args instance","Create a fresh GeoSearchArgs instance per query instead of reusing builders","Inspect the call path to find where the second origin-setting call happens and remove it"],"exampleFix":"// before\nGeoSearchArgs<String> args = GeoSearchArgs.fromMember(\"palermo\").fromLonLat(13.36, 38.11);\n// after\nGeoSearchArgs<String> args = GeoSearchArgs.fromLonLat(13.36, 38.11);","handlingStrategy":"validation","validationCode":"if (argsHasMember && argsHasLonLat) {\n    throw new IllegalStateException(\"Choose either fromMember or fromLonLat, not both\");\n}\ngeoSearch(key, args);","typeGuard":null,"tryCatchPattern":"try {\n    geoSearch(key, args);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"FROMMEMBER and FROMLONLAT\")) {\n        args = rebuildArgsWithSingleOrigin();\n        geoSearch(key, args);\n    } else throw e;\n}","preventionTips":["Build a fresh GeoSearchArgs per query instead of reusing instances","Encapsulate origin selection in one helper that sets exactly one of member/coordinates","Write a unit test covering each origin mode"],"tags":["redis","argument-validation","geo-commands"],"backgroundTag":"mutually-exclusive-arguments","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}