prestodb/presto · error · PrestoException
GENERIC_INTERNAL_ERROR
GENERIC_INTERNAL_ERROR
Error message
Invalid color index: ${index} What it means
SystemColor.valueOf(index) maps a numeric index to a predefined system color; if no registered color matches the index it is treated as an internal invariant violation and throws GENERIC_INTERNAL_ERROR rather than a user-facing argument error.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/scalar/ColorFunctions.java:79
private int getIndex()
{
return index;
}
public String getName()
{
return name;
}
public static SystemColor valueOf(int index)
{
for (SystemColor color : values()) {
if (index == color.getIndex()) {
return color;
}
}
throw new PrestoException(GENERIC_INTERNAL_ERROR, "Invalid color index: " + index);
}
}
private ColorFunctions() {}
@ScalarFunction
@LiteralParameters("x")
@SqlType(ColorType.NAME)
public static long color(@SqlType("varchar(x)") Slice color)
{
int rgb = parseRgb(color);
if (rgb != -1) {
return rgb;
}
// encode system colors (0-15) as negative values, offset by one
try {View on GitHub (pinned to 55bb57d202)
Solutions
- Only pass indices produced by the library's own color()/rgb() functions
- Verify stored color values were not truncated to a smaller integer type
- If hit via SQL, check the input expression feeding the color index
Defensive patterns
Strategy: validation
Validate before calling
boolean ok = SystemColor.isKnownIndex(index);
Prevention
- Use only library-produced color indices
When it happens
Trigger: Calling the internal ColorFunctions SystemColor.valueOf(long index) with an index not matching any system color (e.g. a corrupted or out-of-range color index decoded from stored data).
Common situations: Round-tripping color values through external storage that truncates or renumbers them; hand-crafted queries referencing color() output manipulated numerically.
Related errors
- INVALID_FUNCTION_ARGUMENT
- INVALID_FUNCTION_ARGUMENT
- NUMERIC_VALUE_OUT_OF_RANGE
- NOT_SUPPORTED
- GENERIC_INTERNAL_ERROR
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/7d83849734f2f69c.
Report an issue: GitHub.