prestodb/presto · error · PrestoException
GENERIC_INTERNAL_ERROR
GENERIC_INTERNAL_ERROR
Error message
Error casting array element to VARCHAR
What it means
Runtime failure in ArrayJoin.arrayJoinProvidedBlock: invoking the generated cast of an array element to VARCHAR threw (e.g. an unrepresentable value or a broken cast function); the caught throwable is rewrapped as this cast error while building the joined output string.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/scalar/ArrayJoin.java:340
continue;
}
if (hasOutput) {
blockBuilder.writeBytes(delimiter, 0, delimiter.length());
}
if (arrayBlock.isNull(i)) {
blockBuilder.writeBytes(nullReplacement, 0, nullReplacement.length());
}
else {
try {
Slice slice = (Slice) castFunction.invokeExact(arrayBlock, i, properties);
blockBuilder.writeBytes(slice, 0, slice.length());
}
catch (Throwable throwable) {
// Restore blockBuilder into a consistent state
blockBuilder.closeEntry();
throw new PrestoException(GENERIC_INTERNAL_ERROR, "Error casting array element to VARCHAR", throwable);
}
}
hasOutput = true;
}
blockBuilder.closeEntry();
}
}
View on GitHub (pinned to 55bb57d202)
Solutions
- Pre-cast elements to VARCHAR and handle failures explicitly with TRY_CAST
- Replace nulls using array_join's null-replacement argument instead of relying on casts of nulls
- Filter out elements that cannot be cast to VARCHAR before joining
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/scalar/ArrayJoin.java:340 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/a4adc8a2d73ee814.
Report an issue: GitHub.