apache/seatunnel · error · UnsupportedOperationException
Unsupported convert to Boolean, typeDefine
Error message
Unsupported convert ${value.getClass()} to Boolean, typeDefine: ${typeDefine} What it means
BasicDataConverter.convertBoolean(Object) only knows how to convert Number and String values to Boolean. If the value is any other type (e.g. byte[], Date, or a custom object), it throws this UnsupportedOperationException naming the actual runtime class and the TypeDefine in effect.
Solutions
- Check the raw class printed in the message and add or configure a converter that handles that type before conversion
- Pre-normalize the value to Boolean/Number/String in your source before handing it to the converter
- Implement a custom DataConverter/TypeConverter whose convertBoolean handles the offending type
Example fix
// before Object raw = rs.getObject(col); // returns java.util.UUID converter.convertBoolean(raw, typeDefine); // throws // after Object raw = rs.getObject(col); Object normalized = raw instanceof UUID ? (raw != null ? 1 : 0) : raw; converter.convertBoolean((Number) normalized, typeDefine);
Defensive patterns
Strategy: type-guard
Validate before calling
if (!(value instanceof Number) && !(value instanceof String)) {
throw new IllegalArgumentException("pre-normalize value of class " + value.getClass());
} Type guard
boolean isBooleanConvertible(Object v) {
return v instanceof Number || v instanceof String;
} Try / catch
try {
boolean b = converter.convertBoolean(value, typeDefine);
} catch (UnsupportedOperationException e) {
log.warn("Boolean conversion failed for {}: {}", value.getClass(), e.getMessage());
// normalize or use fallback
} Prevention
- Normalize driver-specific objects to standard Java types before conversion
- Log value.getClass() when debugging converter issues
- Add unit tests covering all runtime types your source can emit
When it happens
Trigger: Calling a converter whose convertBoolean(Object, TypeDefine) default dispatch receives a value that is neither Number nor String after the instanceof checks fail.
Common situations: Reading from a source whose driver returns non-standard objects (e.g. a driver-specific boolean wrapper or byte array) into a connector relying on BasicDataConverter defaults.
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
- 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/5fc186e9a86ce137.
Report an issue: GitHub.
Appendix: source
Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/table/converter/BasicDataConverter.java:1294
return Byte.parseByte(value);
}
default byte convertByte(boolean value) {
return value ? (byte) 1 : (byte) 0;
}
default boolean convertBoolean(T typeDefine, Object value)
throws UnsupportedOperationException {
if (value instanceof Boolean) {
return (Boolean) value;
}
if (value instanceof Number) {
return convertBoolean(typeDefine, (Number) value);
}
if (value instanceof String) {
return convertBoolean(typeDefine, (String) value);
}
throw new UnsupportedOperationException(
"Unsupported convert "
+ value.getClass()
+ " to Boolean, typeDefine: "
+ typeDefine);
}
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;
}View on GitHub (pinned to cf67b549a7)