quarkusio/quarkus · error · RuntimeException

Invalid saturation, number needs to be between 0 and 100. 0%

Error message

Invalid saturation, number needs to be between 0 and 100. 0% is a shade of gray and 100% is the full color (full saturation)

What it means

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 saturation is outside 0–100, since saturation is expressed as a percentage (0 = gray, 100 = full color).

Source

Thrown at extensions/devui/deployment/src/main/java/io/quarkus/devui/deployment/BuildTimeContentProcessor.java:1335

    /**
     * This represents a HSLA color
     * see https://www.w3schools.com/html/html_colors_hsl.asp
     */
    static class Color {
        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
        private int saturation; // Defines the saturation; 0% is a shade of gray and 100% is the full color (full saturation)
        private int lightness; // Defines the lightness; 0% is black, 50% is normal, and 100% is white
        private double alpha; // Defines the opacity; 0 is fully transparent, 100 is not transparent at all

        private Color(int hue, int saturation, int lightness, double alpha) {
            if (hue < 0 || hue > 360) {
                throw new RuntimeException(
                        "Invalid hue, number needs to be between 0 and 360. Defines a degree on the color wheel");
            }
            this.hue = hue;

            if (saturation < 0 || saturation > 100) {
                throw new RuntimeException(
                        "Invalid saturation, number needs to be between 0 and 100. 0% is a shade of gray and 100% is the full color (full saturation)");
            }
            this.saturation = saturation;

            if (lightness < 0 || lightness > 100) {
                throw new RuntimeException(
                        "Invalid lightness, number needs to be between 0 and 100. 0% is black, 50% is normal, and 100% is white");
            }
            this.lightness = lightness;

            if (alpha < 0 || alpha > 1) {
                throw new RuntimeException(
                        "Invalid alpha, number needs to be between 0 and 1. 0 is fully transparent, 1 is not transparent at all");
            }
            this.alpha = alpha;
        }

        @Override

View on GitHub (pinned to e1c734241f)

Solutions

  1. Scale 0–1 saturation to percent: saturation = Math.round(sat01 * 100)
  2. Clamp with Math.max(0, Math.min(100, saturation)) before constructing the Color
  3. Fix the hardcoded or computed value to lie within 0–100

Example fix

// before
Color c = new Color(210, 1.0, 50, 1.0); // 1.0 is 0-1 scale
// after
Color c = new Color(210, (int) Math.round(1.0 * 100), 50, 1.0);
Defensive patterns

Strategy: validation

Validate before calling

int s = (int) Math.round(sat01 * 100); // convert 0-1 to percent
if (s < 0 || s > 100) throw new IllegalArgumentException("saturation must be 0-100");

Type guard

boolean isValidSaturation(int s) { return s >= 0 && s <= 100; }

Try / catch

try {
    Color c = new Color(hue, sat, light, alpha);
} catch (RuntimeException e) {
    if (e.getMessage().startsWith("Invalid saturation")) {
        c = new Color(hue, Math.max(0, Math.min(100, sat)), light, alpha);
    } else throw e;
}

Prevention

When it happens

Trigger: Constructing a Color with a negative saturation or saturation greater than 100 during build-time Dev UI content generation.

Common situations: A custom extension computing saturation from a 0–1 float without scaling to percent; passing an HSL value from a design tool that uses 0–1 saturation; typo in a hardcoded theme value.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/7d5349f9c1e2b0fe. Report an issue: GitHub.