{"record":{"id":"d581cf3ecd64d866","repo":"quarkusio/quarkus","slug":"invalid-hue-number-needs-to-be-between-0-and-360","errorCode":null,"errorMessage":"Invalid hue, number needs to be between 0 and 360. Defines a degree on the color wheel","messagePattern":"Invalid hue, number needs to be between 0 and 360\\. Defines a degree on the color wheel","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"extensions/devui/deployment/src/main/java/io/quarkus/devui/deployment/BuildTimeContentProcessor.java","lineNumber":1329,"sourceCode":"            String defaultValue) {\n        return theme.flatMap(themeModeExtractor) // Extract dark or light theme mode\n                .flatMap(settingExtractor) // Extract specific setting\n                .orElse(defaultValue); // Return default if not present\n    }\n\n    /**\n     * This represents a HSLA color\n     * see https://www.w3schools.com/html/html_colors_hsl.asp\n     */\n    static class Color {\n        private int hue; // Defines a degree on the color wheel (from 0 to 360) - 0 (or 360) is red, 120 is green, 240 is blue\n        private int saturation; // Defines the saturation; 0% is a shade of gray and 100% is the full color (full saturation)\n        private int lightness; // Defines the lightness; 0% is black, 50% is normal, and 100% is white\n        private double alpha; // Defines the opacity; 0 is fully transparent, 100 is not transparent at all\n\n        private Color(int hue, int saturation, int lightness, double alpha) {\n            if (hue < 0 || hue > 360) {\n                throw new RuntimeException(\n                        \"Invalid hue, number needs to be between 0 and 360. Defines a degree on the color wheel\");\n            }\n            this.hue = hue;\n\n            if (saturation < 0 || saturation > 100) {\n                throw new RuntimeException(\n                        \"Invalid saturation, number needs to be between 0 and 100. 0% is a shade of gray and 100% is the full color (full saturation)\");\n            }\n            this.saturation = saturation;\n\n            if (lightness < 0 || lightness > 100) {\n                throw new RuntimeException(\n                        \"Invalid lightness, number needs to be between 0 and 100. 0% is black, 50% is normal, and 100% is white\");\n            }\n            this.lightness = lightness;\n\n            if (alpha < 0 || alpha > 1) {\n                throw new RuntimeException(","sourceCodeStart":1311,"sourceCodeEnd":1347,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/devui/deployment/src/main/java/io/quarkus/devui/deployment/BuildTimeContentProcessor.java#L1311-L1347","documentation":"The BuildTimeContentProcessor.Color record validates the HSL color components used to generate per-extension Dev UI theme colors. This error is thrown by the Color constructor when the hue is outside the 0–360 degree range, since hue is a degree on the color wheel and values outside it are not representable.","triggerScenarios":"An extension (or Dev UI code) constructs a Color (e.g. via its factory/fromHSL path) with a negative hue or hue greater than 360 during build-time content generation.","commonSituations":"A custom extension computing a theme hue from a hash or config value without normalizing modulo 360; off-by-one on a 360-based calculation; hand-edited extension color values.","solutions":["Normalize hue into range: hue = ((hue % 360) + 360) % 360 before constructing the Color","Clamp hue with Math.floorMod(hue, 360) or Math.min/max","Fix the source of the hue value (hash function, config default) to always produce 0–360"],"exampleFix":"// before\nColor c = new Color(hueFromConfig, 60, 50, 1.0); // hue may be 540\n// after\nColor c = new Color(Math.floorMod(hueFromConfig, 360), 60, 50, 1.0);","handlingStrategy":"validation","validationCode":"int normalizedHue = Math.floorMod(hue, 360);\nif (hue < 0 || hue > 360) throw new IllegalArgumentException(\"hue must be 0-360\");","typeGuard":"boolean isValidHue(int hue) { return hue >= 0 && hue <= 360; }","tryCatchPattern":"try {\n    Color c = new Color(hue, sat, light, alpha);\n} catch (RuntimeException e) {\n    if (e.getMessage().startsWith(\"Invalid hue\")) {\n        c = new Color(Math.floorMod(hue, 360), sat, light, alpha);\n    } else throw e;\n}","preventionTips":["Normalize hash-derived hues with Math.floorMod(x, 360)","Clamp all HSL inputs at construction call sites","Add unit tests covering hue boundaries 0 and 360"],"tags":["devui","build-time","color","argument-validation"],"backgroundTag":"invalid-argument-range","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"}