apache/seatunnel · error · UnsupportedOperationException
Unsupported convert ${value.getClass()} to LocalDate
Error message
Unsupported convert ${value.getClass()} to LocalDate What it means
The typeDefine-less convertLocalDate(Object) handles String, Number and temporal values; an unhandled class causes UnsupportedOperationException naming the value's class. The converter throws because it cannot interpret the value as a LocalDate.
Source
Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/table/converter/BasicDataConverter.java:788
if (value instanceof LocalDate) {
return (LocalDate) value;
}
if (value instanceof Date) {
return convertLocalDate((Date) value);
}
if (value instanceof LocalDateTime) {
return ((LocalDateTime) value).toLocalDate();
}
if (value instanceof java.sql.Date) {
return ((java.sql.Date) value).toLocalDate();
}
if (value instanceof String) {
return convertLocalDate((String) value);
}
if (value instanceof Number) {
return convertLocalDate((Number) value);
}
throw new UnsupportedOperationException(
"Unsupported convert " + value.getClass() + " to LocalDate");
}
default LocalDate convertLocalDate(Date value) {
return value.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
}
default LocalDate convertLocalDate(String value) {
return LocalDate.parse(value);
}
default LocalDate convertLocalDate(Number value) {
if (value.longValue() < 999999999) {
return LocalDateTime.ofEpochSecond(
value.longValue(),
0,
ZoneId.systemDefault().getRules().getOffset(LocalDateTime.now()))
.toLocalDate();View on GitHub (pinned to cf67b549a7)
Solutions
- Pre-convert the value to LocalDate, ISO-8601 String, or epoch Number before calling convert
- Inspect the named class and add a custom converter branch if the source always emits it
- Fix the source schema/mapping so the field type aligns with the DATE column
Example fix
// before converter.convert(calendarObj); // throws // after LocalDate d = ((java.util.Calendar) calendarObj).toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); converter.convert(d);
Defensive patterns
Strategy: type-guard
Validate before calling
if (!(v instanceof Number) && !(v instanceof String) && !(v instanceof java.time.temporal.TemporalAccessor) && !(v instanceof java.util.Date)) {
throw new IllegalStateException("Unsupported date class: " + v.getClass());
} Type guard
boolean isConvertibleToDate(Object v) {
return v instanceof Number || v instanceof String
|| v instanceof java.time.temporal.TemporalAccessor
|| v instanceof java.util.Date;
} Try / catch
try {
converter.convert(value);
} catch (UnsupportedOperationException e) {
LOG.warn("Date convert failed, class={}", value.getClass(), e);
value = normalizeToDate(value);
} Prevention
- Convert Calendar/legacy Date types to LocalDate at the boundary
- Audit schema drift after format/deserializer changes
- Prefer ISO-8601 strings or epoch numbers when interoperating across systems
When it happens
Trigger: Calling convert()/convertLocalDate(Object) with e.g. java.util.Calendar, char[], or an application object for a DATE column where no instanceof branch matches.
Common situations: Custom transforms forwarding untyped Objects; upstream format change (e.g. Avro date logical type now deserialized as a custom class); accidentally passing a timestamp object where the target expects only a date.
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 LocalDate, typeDe
- Unsupported convert ${value.getClass()} to LocalTime, typeDe
- Unsupported convert ${value.getClass()} to LocalTime
- Unsupported convert ${value.getClass()} to BigDecimal, typeD
- Unsupported convert ${value.getClass()} to BigDecimal
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/fa52a74d0b3efc8b.
Report an issue: GitHub.