quarkusio/quarkus · error · RuntimeException
Invalid alpha, number needs to be between 0 and 1. 0 is full
Error message
Invalid alpha, number needs to be between 0 and 1. 0 is fully transparent, 1 is not transparent at all
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 alpha is outside 0–1, since alpha is an opacity factor (0 = fully transparent, 1 = fully opaque) — note this is the one component on a 0–1 scale rather than percent.
Source
Thrown at extensions/devui/deployment/src/main/java/io/quarkus/devui/deployment/BuildTimeContentProcessor.java:1347
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
public String toString() {
return "hsla(" + this.hue + ", " + this.saturation + "%, " + this.lightness + "%, " + this.alpha + ")";
}
static Color from(Color color, double alpha) {
return new Color(color.hue, color.saturation, color.lightness, alpha);
}
static Color from(int hue, int saturation, int lightness) {
return new Color(hue, saturation, lightness, 1);
}
View on GitHub (pinned to e1c734241f)
Solutions
- Convert percent alpha to 0–1: alpha = alphaPercent / 100.0
- Clamp with Math.max(0.0, Math.min(1.0, alpha)) before constructing the Color
- Fix the hardcoded or computed value to lie within 0–1
Example fix
// before Color c = new Color(210, 60, 50, 100); // percent, wrong scale // after Color c = new Color(210, 60, 50, 100 / 100.0);
Defensive patterns
Strategy: validation
Validate before calling
double a = alphaPercent / 100.0; // convert percent to 0-1
if (a < 0.0 || a > 1.0) throw new IllegalArgumentException("alpha must be 0-1"); Type guard
boolean isValidAlpha(double a) { return a >= 0.0 && a <= 1.0; } Try / catch
try {
Color c = new Color(hue, sat, light, alpha);
} catch (RuntimeException e) {
if (e.getMessage().startsWith("Invalid alpha")) {
c = new Color(hue, sat, light, Math.max(0.0, Math.min(1.0, alpha)));
} else throw e;
} Prevention
- Remember alpha is 0–1 (unlike saturation/lightness percent)
- Divide percent values by 100 before passing alpha
- Clamp alpha at call sites and test boundaries 0.0 and 1.0
When it happens
Trigger: Constructing a Color with a negative alpha or alpha greater than 1 during build-time Dev UI content generation.
Common situations: Passing alpha as a percentage (e.g. 100) when the constructor expects 0–1; using a CSS percent value without dividing by 100; typo in a hardcoded theme value.
Related errors
- Invalid hue, number needs to be between 0 and 360. Defines a
- Invalid saturation, number needs to be between 0 and 100. 0%
- Invalid lightness, number needs to be between 0 and 100. 0%
- An error occurred while processing ${resourceName}
- Failed to read ${extPropsVisitUrl}
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/6fd6cbe85918bf1f.
Report an issue: GitHub.