apache/seatunnel · error · UnsupportedOperationException
Unsupported convert ${value.getClass()} to OffsetDateTime, t
Error message
Unsupported convert ${value.getClass()} to OffsetDateTime, typeDefine: ${typeDefine} What it means
convertOffsetDateTime supports OffsetDateTime, LocalDateTime (converted via zone), String (parsed with OffsetDateTime.parse), and related temporal inputs; any other class throws this UnsupportedOperationException naming the class and typeDefine. It means the value routed to TIMESTAMP_WITH_TIMEZONE conversion cannot be interpreted as an OffsetDateTime.
Source
Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/table/converter/BasicDataConverter.java:478
return ((java.sql.Timestamp) value)
.toInstant()
.atZone(ZoneId.systemDefault())
.toOffsetDateTime();
}
if (value instanceof Date) {
return ((Date) value).toInstant().atZone(ZoneId.systemDefault()).toOffsetDateTime();
}
if (value instanceof LocalDate) {
return ((LocalDate) value)
.atTime(LocalTime.MIDNIGHT)
.atZone(ZoneId.systemDefault())
.toOffsetDateTime();
}
if (value instanceof String) {
return OffsetDateTime.parse((String) value);
}
throw new UnsupportedOperationException(
"Unsupported convert "
+ value.getClass()
+ " to OffsetDateTime, typeDefine: "
+ typeDefine);
}
default LocalDateTime convertLocalDateTime(T typeDefine, Instant value) {
return convertLocalDateTime(value);
}
default LocalDateTime convertLocalDateTime(T typeDefine, Date value) {
return convertLocalDateTime(value);
}
default LocalDateTime convertLocalDateTime(T typeDefine, String value) {
return convertLocalDateTime(value);
}
View on GitHub (pinned to cf67b549a7)
Solutions
- Convert the value explicitly first: instant.atZone(zone).toOffsetDateTime(), ts.toInstant().atOffset(ZoneOffset.UTC), etc.
- If the value is a String, ensure it is ISO-8601 with an offset, or parse it with a custom DateTimeFormatter before passing an OffsetDateTime.
- Override convertOffsetDateTime in a converter subclass for framework-specific temporal types.
- Align the schema: if offsets are irrelevant, use a TIMESTAMP column with LocalDateTime instead.
Example fix
// before converter.convertOffsetDateTime(typeDefine, sqlTimestamp); // after converter.convertOffsetDateTime(typeDefine, sqlTimestamp.toInstant().atOffset(ZoneOffset.UTC));
Defensive patterns
Strategy: type-guard
Validate before calling
if (!(value instanceof OffsetDateTime) && !(value instanceof LocalDateTime) && !(value instanceof String)
&& !(value instanceof java.time.ZonedDateTime) && !(value instanceof java.time.Instant)) {
throw new IllegalArgumentException("Unsupported offset datetime input: " + value.getClass());
} Type guard
boolean isOffsetDateTimeConvertible(Object v) {
return v instanceof OffsetDateTime || v instanceof LocalDateTime || v instanceof String
|| v instanceof ZonedDateTime || v instanceof Instant;
} Try / catch
try {
return converter.convertOffsetDateTime(typeDefine, value);
} catch (UnsupportedOperationException e) {
LOG.warn("OffsetDateTime conversion failed for {}: {}", value.getClass(), e.getMessage());
return null;
} Prevention
- Convert Instant/Date/Timestamp via atOffset(ZoneOffset.UTC) or atZone(zone).toOffsetDateTime().
- Ensure String inputs are ISO-8601 with an offset before passing them.
- Pick TIMESTAMP (LocalDateTime) instead of TIMESTAMP_WITH_TIMEZONE when offsets are irrelevant.
- Pin a default ZoneId in application config for consistent conversions.
When it happens
Trigger: Calling convertOffsetDateTime(typeDefine, value) — or convert(...) with a TIMESTAMP_WITH_LOCAL_TIME_ZONE/SqlType mapping to OffsetDateTime — with an Instant, java.util.Date, java.sql.Timestamp, ZonedDateTime, Long, or unparseable date object.
Common situations: Drivers returning java.sql.Timestamp or Instant while the schema expects OffsetDateTime; legacy epoch-millis Longs; date strings in a non-ISO-8601 format reaching OffsetDateTime.parse and failing earlier, or non-temporal objects hitting this throw.
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 LocalDateTime, ty
- Unsupported convert ${value.getClass()} to LocalDateTime
- Unsupported convert %s to Map, typeDefine: %s
- Unsupported convert %s to Array, typeDefine: %s
- Unsupported convert ${value.getClass()} to Row, typeDefine:
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/03d5a86bcef496a7.
Report an issue: GitHub.