{"record":{"id":"e0f1eaa468b06ce8","repo":"quarkusio/quarkus","slug":"width-must-be-positive","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/GeoSearchArgs.java","lineNumber":94,"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 GeoSearchArgs}\n     **/\n    public GeoSearchArgs<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 GeoRadiusArgs}\n     **/","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/geo/GeoSearchArgs.java#L76-L112","documentation":"GeoSearchArgs.byBox defines a BYBOX search area with width, height, and unit; negative dimensions are geometrically invalid, so width is validated first and a negative value throws IllegalArgumentException. Height and unit get their own checks afterward, so this error indicates the width specifically was negative.","triggerScenarios":"Calling byBox(-5, 10, GeoUnit.KM) or passing a width derived from data that can go negative (difference of coordinates, sentinel value, bad parse).","commonSituations":"Bounding boxes computed from min/max points in wrong order producing negative extents; config sentinels of -1 meaning 'unset'; swapped width/height arguments.","solutions":["Ensure width is non-negative before calling byBox, e.g. Math.abs or taking max-min in the right order","Fix the calculation that produces the box extent","Validate config-provided dimensions at startup"],"exampleFix":"// before\ndouble width = x2 - x1; // x2 < x1 possible\nargs.byBox(width, height, GeoUnit.KM);\n// after\ndouble width = Math.abs(x2 - x1);\nargs.byBox(width, height, GeoUnit.KM);","handlingStrategy":"validation","validationCode":"if (width < 0) { throw new IllegalStateException(\"width must be >= 0\"); }","typeGuard":null,"tryCatchPattern":"try { args.byBox(width, height, unit); } catch (IllegalArgumentException e) { log.warn(\"Bad box: \" + e.getMessage()); }","preventionTips":["Compute box extents as abs(max - min)","Validate dimensions when loading from config","Check argument order for width/height"],"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-12T22:17:10.623Z"}