prestodb/presto · error · IllegalArgumentException
Unexpected type found: %s
Error message
Unexpected type found: %s
What it means
Recursive value fixer in the client hit a value whose shape does not match any known signature branch (not ARRAY, MAP, ROW, or a recognized scalar), so it cannot normalize the JSON value to the declared type.
Source
Thrown at presto-client/src/main/java/com/facebook/presto/client/FixJsonDataUtils.java:121
return fixValue(signature.getDistinctTypeInfo().getBaseType(), value);
}
if (signature.getTypeSignatureBase().hasTypeName() && signature.getTypeSignatureBase().hasStandardType()) {
return fixValue(signature.getStandardTypeSignature(), value);
}
if (signature.getBase().equals(ARRAY)) {
if (List.class.isAssignableFrom(value.getClass())) {
List<Object> fixedValue = new ArrayList<>();
for (Object object : List.class.cast(value)) {
fixedValue.add(fixValue(signature.getTypeOrNamedTypeParametersAsTypeSignatures().get(0), object));
}
return fixedValue;
}
// JSON keys may be serialized and deserialized as simple strings
else if (value.getClass() == String.class) {
List<String> newValue = LIST_JSON_CODEC.fromJson(value.toString());
return fixValue(signature, newValue);
}
throw new IllegalArgumentException(String.format("Unexpected type found: %s", value.getClass()));
}
if (signature.getBase().equals(MAP)) {
if (Map.class.isAssignableFrom(value.getClass())) {
TypeSignature keySignature = signature.getTypeOrNamedTypeParametersAsTypeSignatures().get(0);
TypeSignature valueSignature = signature.getTypeOrNamedTypeParametersAsTypeSignatures().get(1);
Map<Object, Object> fixedValue = new HashMap<>();
for (Map.Entry<?, ?> entry : (Set<Map.Entry<?, ?>>) Map.class.cast(value).entrySet()) {
fixedValue.put(fixValue(keySignature, entry.getKey()), fixValue(valueSignature, entry.getValue()));
}
return fixedValue;
}
// JSON keys may be serialized and deserialized as simple strings
else if (value.getClass() == String.class) {
Map<String, String> newValue = MAP_JSON_CODEC.fromJson(value.toString());
return fixValue(signature, newValue);
}
throw new IllegalArgumentException(String.format("Unexpected type found: %s", value.getClass()));
}View on GitHub (pinned to 55bb57d202)
Solutions
- Check that the query result type signature and the returned data agree
- Upgrade client and server to matching versions so new type signatures are recognized
- Simplify the query to avoid the exotic type if client upgrade is impossible
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at presto-client/src/main/java/com/facebook/presto/client/FixJsonDataUtils.java:121 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/c82e7ddbbdffa66b.
Report an issue: GitHub.