{"record":{"id":"826a2fdf51ac142a","repo":"quarkusio/quarkus","slug":"width-must-be-positive-826a2f","errorCode":null,"errorMessage":"`width` must be positive","messagePattern":"`width` must be positive","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/geo/GeoSearchStoreArgs.java","lineNumber":88,"sourceCode":"        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 GeoSearchStoreArgs}\n     **/\n    public GeoSearchStoreArgs<V> byBox(double width, double height, GeoUnit unit) {\n        if (width < 0) {\n            throw new IllegalArgumentException(\"`width` must be positive\");\n        }\n        if (height < 0) {\n            throw new IllegalArgumentException(\"`height` must be positive\");\n        }\n        if (unit == null) {\n            throw new IllegalArgumentException(\"`unit` cannot be `null`\");\n        }\n        this.width = width;\n        this.height = height;\n        this.unit = unit;\n        return this;\n    }\n\n    /**\n     * Use {@code ASC} order (from small to large).\n     *\n     * @return the current {@code GeoSearchStoreArgs}\n     **/","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/geo/GeoSearchStoreArgs.java#L70-L106","documentation":"GeoSearchStoreArgs.byBox(width, height, unit) rejects a negative width with IllegalArgumentException. Redis BYBOX requires non-negative dimensions; a negative width is invalid input for the GEOSEARCHSTORE command.","triggerScenarios":"Calling byBox(-x, height, unit), typically from computed dimensions that went negative (e.g. subtracting coordinates or size arithmetic errors).","commonSituations":"Bounding-box computed from min/max points in the wrong order (max - min < 0); unsanitized user input; unit-conversion mistakes.","solutions":["Compute the box as Math.abs(max - min) or normalize min/max before calling byBox","Validate width >= 0 at the input boundary","Fix the arithmetic producing the width"],"exampleFix":"// before\ndouble width = p2.lon - p1.lon; // can be negative\nargs.byBox(width, height, GeoUnit.km);\n// after\ndouble width = Math.abs(p2.lon - p1.lon);\nargs.byBox(width, height, GeoUnit.km);","handlingStrategy":"validation","validationCode":"if (width < 0) {\n    throw new IllegalArgumentException(\"width must be >= 0, got \" + width);\n}\nargs.byBox(width, height, unit);","typeGuard":"boolean isValidWidth(double width) { return !Double.isNaN(width) && width >= 0; }","tryCatchPattern":"try {\n    args.byBox(width, height, unit);\n} catch (IllegalArgumentException e) {\n    log.error(\"Invalid box width {}: {}\", width, e.getMessage());\n    throw new BadRequestException(\"Box dimensions must be non-negative\");\n}","preventionTips":["Compute dimensions as Math.abs(max - min)","Normalize min/max points before deriving width/height","Validate box inputs at the service boundary"],"tags":["redis","argument-validation","geo-commands","numeric-range"],"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-12T22:17:10.623Z"}