{"record":{"id":"6bc65c74005bb8aa","repo":"quarkusio/quarkus","slug":"radius-must-be-positive","errorCode":null,"errorMessage":"`radius` must be positive","messagePattern":"`radius` must be positive","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/geo/GeoSearchArgs.java","lineNumber":74,"sourceCode":"     * @param latitude the latitude\n     * @return the current {@code GeoSearchArgs}\n     */\n    public GeoSearchArgs<V> fromCoordinate(double longitude, double latitude) {\n        this.longitude = longitude;\n        this.latitude = latitude;\n        return this;\n    }\n\n    /**\n     * Search inside circular area according to given {@code radius}.\n     *\n     * @param radius the radius value\n     * @param unit the unit\n     * @return the current {@code GeoSearchArgs}\n     **/\n    public GeoSearchArgs<V> byRadius(double radius, GeoUnit unit) {\n        if (radius < 0) {\n            throw new IllegalArgumentException(\"`radius` must be positive\");\n        }\n        if (unit == null) {\n            throw new IllegalArgumentException(\"`unit` cannot be `null`\");\n        }\n        this.radius = radius;\n        this.unit = unit;\n        return this;\n    }\n\n    /**\n     * Search inside circular area according to given {@code radius}.\n     *\n     * @param width the width of the box\n     * @param height the height of the box\n     * @param unit the unit\n     * @return the current {@code GeoSearchArgs}\n     **/\n    public GeoSearchArgs<V> byBox(double width, double height, GeoUnit unit) {","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/geo/GeoSearchArgs.java#L56-L92","documentation":"GeoSearchArgs.byRadius defines a BYRADIUS search area; a negative radius has no geometric meaning and Redis would reject or misinterpret it, so the client validates that radius >= 0 and throws IllegalArgumentException otherwise. The unit is validated separately. Note the check only rejects strictly negative values, so 0 is technically accepted.","triggerScenarios":"Calling byRadius(-1, GeoUnit.KM) or passing a radius computed from data that can be negative (e.g. a subtraction, a parsed config value with a sign, an unset default of -1).","commonSituations":"Config properties where a negative number is used as a 'disabled' sentinel; calculation errors producing negative distance; copy/paste of byBox width/height values into byRadius.","solutions":["Pass a non-negative radius value; validate/normalize the input before calling byRadius","Fix the upstream calculation or config default that yields a negative value","Use Math.max(0, radius) only if a zero radius is an acceptable search result"],"exampleFix":"// before\ndouble radius = max - min; // can be negative\nargs.byRadius(radius, GeoUnit.KM);\n// after\ndouble radius = Math.abs(max - min);\nif (radius < 0) { throw new IllegalStateException(\"invalid radius\"); }\nargs.byRadius(radius, GeoUnit.KM);","handlingStrategy":"validation","validationCode":"if (radius < 0) { throw new IllegalStateException(\"radius must be >= 0\"); }","typeGuard":null,"tryCatchPattern":"try { args.byRadius(radius, unit); } catch (IllegalArgumentException e) { log.warn(\"Rejected radius: \" + e.getMessage()); }","preventionTips":["Validate config-driven radii at startup","Compute extents with abs/max-min to avoid negatives","Avoid negative sentinels for 'unset' values"],"tags":["redis","geo","illegal-argument","argument-validation"],"backgroundTag":"invalid-argument-value","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"}