apache/seatunnel · error · UnsupportedOperationException
Unsupported convert ${value.getClass()} to Integer, typeDefi
Error message
Unsupported convert ${value.getClass()} to Integer, typeDefine: ${typeDefine} What it means
Thrown by BasicDataConverter.convertInt(T typeDefine, Object value) when the value is neither a LocalDate nor a LocalDateTime. Integer conversion supports date values (as days/seconds) and, via other branches, Number/String; any other class triggers this exception with the value class and type definition in the message.
Source
Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/table/converter/BasicDataConverter.java:1089
if (value instanceof String) {
return convertInt(typeDefine, (String) value);
}
if (value instanceof Time) {
return convertInt(typeDefine, (Time) value);
}
if (value instanceof LocalTime) {
return convertInt(typeDefine, (LocalTime) value);
}
if (value instanceof Date) {
return convertInt(typeDefine, (Date) value);
}
if (value instanceof LocalDate) {
return convertInt(typeDefine, (LocalDate) value);
}
if (value instanceof LocalDateTime) {
return convertInt(typeDefine, (LocalDateTime) value);
}
throw new UnsupportedOperationException(
"Unsupported convert "
+ value.getClass()
+ " to Integer, typeDefine: "
+ typeDefine);
}
default int convertInt(T typeDefine, Number value) {
return convertInt(value);
}
default int convertInt(T typeDefine, String value) {
return convertInt(value);
}
default int convertInt(T typeDefine, Time value) {
return convertInt(value);
}
View on GitHub (pinned to cf67b549a7)
Solutions
- Unwrap/convert the value before conversion (Integer.parseInt for numeric strings, boolean ? 1 : 0, ByteBuffer/byte[] decode)
- Correct the catalog type: use DATE/TIMESTAMP for date values or STRING/VARCHAR for textual values instead of forcing INT
- Override convertInt(T typeDefine, Object value) in a custom converter to support the reported class
Example fix
// before int i = converter.convertInt(typeDefine, row.getField(0)); // String throws // after Object v = row.getField(0); int i = (v instanceof String) ? Integer.parseInt((String) v) : converter.convertInt(typeDefine, v);
Defensive patterns
Strategy: type-guard
Validate before calling
Object v = row.getField(0);
if (!(v instanceof Number) && !(v instanceof String) && !(v instanceof LocalDate) && !(v instanceof LocalDateTime)) {
throw new IllegalArgumentException("Value " + v.getClass() + " is not convertible to INT");
} Type guard
static boolean isIntConvertible(Object v) {
return v instanceof Number || v instanceof String || v instanceof LocalDate || v instanceof LocalDateTime;
} Try / catch
try {
i = converter.convertInt(typeDefine, value);
} catch (UnsupportedOperationException e) {
LOG.warn("Inconvertible value {} for INT: {}", value, e.getMessage());
i = 0;
} Prevention
- Confirm the sink catalog type matches the extracted field type before job submission
- Convert byte[]/Boolean values explicitly in a transform step
- Cover each field type in converter unit tests
When it happens
Trigger: Calling convertInt(typeDefine, value) with a String, byte[], Boolean, java.util.Date or nested object while mapping a field to an INT column.
Common situations: Source emits numeric strings or booleans but the sink schema says INT; column type in the target table changed from DATE/TIMESTAMP to INT; a custom connector passes raw objects (e.g. byte-encoded ints) without unwrapping them first.
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 ${value.getClass()} to Float, typeDefine
- Unsupported convert ${value.getClass()} to Float
- Unsupported convert ${value.getClass()} to Long, typeDefine:
- Unsupported convert ${value.getClass()} to Long
- Unsupported convert ${value.getClass()} to Integer
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/c1e07c8f0d3e4a98.
Report an issue: GitHub.