{"record":{"id":"5d9461e28ac7688c","repo":"quarkusio/quarkus","slug":"frommember-and-fromlonlat-cannot-be-used-together-5d9461","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/GeoSearchStoreArgs.java","lineNumber":160,"sourceCode":"     **/\n    public GeoSearchStoreArgs<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":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/geo/GeoSearchStoreArgs.java#L142-L178","documentation":"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.","triggerScenarios":"Calling both fromMember(...) and fromLonLat(...) (or fromCoordinates) on the same GeoSearchStoreArgs instance before executing the store command.","commonSituations":"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.","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"],"exampleFix":"// before\nGeoSearchStoreArgs<String> args = GeoSearchStoreArgs.fromMember(\"palermo\").fromLonLat(13.36, 38.11);\n// after\nGeoSearchStoreArgs<String> args = GeoSearchStoreArgs.fromMember(\"palermo\");","handlingStrategy":"validation","validationCode":"if (member != null && center != null) {\n    throw new IllegalStateException(\"Choose either fromMember or fromLonLat, not both\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    geoSearchStore(key, dest, args);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"FROMMEMBER and FROMLONLAT\")) {\n        args = rebuildArgsWithSingleOrigin();\n        geoSearchStore(key, dest, args);\n    } else throw e;\n}","preventionTips":["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"],"tags":["redis","argument-validation","geo-commands","mutually-exclusive"],"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"}