apache/seatunnel · error · UnsupportedOperationException
Unsupported convert to Boolean
Error message
Unsupported convert ${value.getClass()} to Boolean What it means
The TypeDefine-less overload of convertBoolean in BasicDataConverter dispatches on Number and String only; any other runtime type reaches the terminal throw. The message includes the value's class so you can see what unexpected type arrived.
Solutions
- Convert the value to Number or String before calling convertBoolean
- Inspect the printed class and add a targeted pre-processing step or custom converter
- If the value is actually valid boolean data, fix the upstream deserialization so it yields a standard type
Example fix
// before converter.convertBoolean(byteArrayValue); // throws // after boolean b = byteArrayValue.length > 0 && byteArrayValue[0] != 0; // or pass a Number converter.convertBoolean(byteArrayValue[0] != 0 ? 1 : 0);
Defensive patterns
Strategy: type-guard
Validate before calling
if (!(value instanceof Number) && !(value instanceof String)) {
value = normalizeToNumber(value);
} Type guard
static boolean canConvertBoolean(Object v) {
return v instanceof Number || v instanceof String;
} Try / catch
try {
boolean b = converter.convertBoolean(value);
} catch (UnsupportedOperationException e) {
throw new IllegalArgumentException("Unexpected boolean value type " + value.getClass(), e);
} Prevention
- Deserialize into SeaTunnel standard types before converting
- Check the class named in the message and add handling for it
- Prefer the TypeDefine-aware overload for richer diagnostics
When it happens
Trigger: Invoking BasicDataConverter.convertBoolean(Object) with a value whose class is not Number and not String.
Common situations: Deserialization producing byte[] or driver-specific objects (e.g. from CDC formats) fed into generic boolean conversion.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- Unsupported convert to Boolean, typeDefine
- Unsupported convert to Byte
- Unsupported convert to Byte, typeDefine
- Unsupported convert to Float, typeDefine
- Unsupported convert to Float
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/c14aed6e927ff695.
Report an issue: GitHub.
Appendix: source
Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/table/converter/BasicDataConverter.java:1319
default boolean convertBoolean(T typeDefine, Number value) {
return convertBoolean(value);
}
default boolean convertBoolean(T typeDefine, String value) {
return convertBoolean(value);
}
default boolean convertBoolean(Object value) throws UnsupportedOperationException {
if (value instanceof Boolean) {
return (Boolean) value;
}
if (value instanceof Number) {
return convertBoolean((Number) value);
}
if (value instanceof String) {
return convertBoolean((String) value);
}
throw new UnsupportedOperationException(
"Unsupported convert " + value.getClass() + " to Boolean");
}
default boolean convertBoolean(Number value) {
return value.intValue() != 0;
}
default boolean convertBoolean(String value) {
return Boolean.parseBoolean(value);
}
}
View on GitHub (pinned to cf67b549a7)