apache/seatunnel · error · UnsupportedOperationException
Unsupported convert to Byte, typeDefine
Error message
Unsupported convert ${value.getClass()} to Byte, typeDefine: ${typeDefine} What it means
Thrown by BasicDataConverter.convertByte(T typeDefine, Object value) when the value is neither a String nor a Boolean in this dispatch path (Number is handled via a separate overloaded branch). Byte conversion supports string parsing and boolean-to-0/1 mapping; any other class is rejected with the value class and type definition in the message.
Solutions
- Decode or convert the value first (e.g. byte[0] for byte[], toEpochDay() for LocalDate, numeric parse for strings representing ints)
- Correct the sink catalog type so it matches the actual source data type
- Override convertByte(T typeDefine, Object value) in a custom converter to support the reported class
Example fix
// before byte b = converter.convertByte(typeDefine, row.getField(0)); // byte[] throws // after Object v = row.getField(0); byte b = (v instanceof byte[] && ((byte[]) v).length == 1) ? ((byte[]) v)[0] : converter.convertByte(typeDefine, v);
Defensive patterns
Strategy: type-guard
Validate before calling
Object v = row.getField(0);
if (!(v instanceof Number) && !(v instanceof String) && !(v instanceof Boolean)) {
throw new IllegalArgumentException("Value " + v.getClass() + " is not convertible to BYTE");
} Type guard
static boolean isByteConvertible(Object v) {
return v instanceof Number || v instanceof String || v instanceof Boolean;
} Try / catch
try {
b = converter.convertByte(typeDefine, value);
} catch (UnsupportedOperationException e) {
LOG.warn("Inconvertible value {} for TINYINT: {}", value, e.getMessage());
b = 0;
} Prevention
- Do not map BINARY/BYTES source columns to TINYINT; unwrap single-byte arrays yourself
- Validate the catalog schema against source metadata before submission
- Add converter tests for date and binary inputs
When it happens
Trigger: Calling convertByte(typeDefine, value) with byte[], LocalDate, Number subclass routed through this branch, Map or other objects while mapping a field to a TINYINT column.
Common situations: A source column typed BINARY/BYTES or DATE is mapped to TINYINT in the sink; nested/struct values reaching scalar converters; catalog definitions changed without updating field extraction.
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 Boolean
- Unsupported convert to Byte
- Unsupported convert to Float, typeDefine
- Unsupported convert to Float
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/0cc9e78d8deaf528.
Report an issue: GitHub.
Appendix: source
Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/table/converter/BasicDataConverter.java:1238
default short convertShort(String value) {
return Short.parseShort(value);
}
default byte convertByte(T typeDefine, Object value) throws UnsupportedOperationException {
if (value instanceof Byte) {
return (byte) value;
}
if (value instanceof Number) {
return convertByte(typeDefine, (Number) value);
}
if (value instanceof String) {
return convertByte(typeDefine, (String) value);
}
if (value instanceof Boolean) {
return convertByte(typeDefine, ((boolean) value));
}
throw new UnsupportedOperationException(
"Unsupported convert " + value.getClass() + " to Byte, typeDefine: " + typeDefine);
}
default byte convertByte(T typeDefine, Number value) {
return convertByte(value);
}
default byte convertByte(T typeDefine, String value) {
return convertByte(value);
}
default byte convertByte(T typeDefine, boolean value) {
return convertByte(value);
}
default byte convertByte(Object value) throws UnsupportedOperationException {
if (value instanceof Byte) {
return (byte) value;View on GitHub (pinned to cf67b549a7)