{"record":{"id":"43208b815d735664","repo":"quarkusio/quarkus","slug":"height-must-be-positive-43208b","errorCode":null,"errorMessage":"`height` must be positive","messagePattern":"`height` 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":91,"sourceCode":"        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     **/\n    public GeoSearchStoreArgs<V> ascending() {\n        this.direction = \"ASC\";\n        return this;","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/geo/GeoSearchStoreArgs.java#L73-L109","documentation":"Thrown by GeoSearchStoreArgs.byBox when building a GEOSEARCH/GEORADIUSBYMEMBER-style bounding-box search with a negative height (width has its own sibling check). A box with a negative dimension describes no searchable area, so the argument guard rejects it immediately, naming 'height' as the offending dimension of the three (width, height, unit) parameters.","triggerScenarios":"Calling byBox(width, -y, unit), usually from bounding-box arithmetic where the points are ordered so that max - min is negative, or from unsanitized input.","commonSituations":"Swapped min/max latitude when computing the box height; user-entered dimensions not validated; conversion errors between coordinate systems.","solutions":["Compute height as Math.abs(maxLat - minLat) before calling byBox","Validate height >= 0 at the input boundary","Fix the ordering/arithmetic of the points used to derive the height"],"exampleFix":"// before\ndouble height = p1.lat - p2.lat; // can be negative\nargs.byBox(width, height, GeoUnit.km);\n// after\ndouble height = Math.abs(p1.lat - p2.lat);\nargs.byBox(width, height, GeoUnit.km);","handlingStrategy":"validation","validationCode":"if (height < 0) {\n    throw new IllegalArgumentException(\"height must be >= 0, got \" + height);\n}\nargs.byBox(width, height, unit);","typeGuard":"boolean isValidHeight(double height) { return !Double.isNaN(height) && height >= 0; }","tryCatchPattern":"try {\n    args.byBox(width, height, unit);\n} catch (IllegalArgumentException e) {\n    log.error(\"Invalid box height {}: {}\", height, e.getMessage());\n    throw new BadRequestException(\"Box dimensions must be non-negative\");\n}","preventionTips":["Use Math.abs for height derived from two latitudes","Check point ordering (min/max) when building bounding boxes","Test with degenerate boxes (zero and negative extents)"],"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"}