apache/seatunnel · error · IllegalArgumentException
Unsupported timestamp type:
Error message
Unsupported timestamp type:
What it means
convertTimestampToLong() converts a TemporalAccessor (e.g. LocalDateTime, ZonedDateTime) timestamp value to epoch millis via Instant.from(). If the value passed for a LONG-typed field is neither a Number, String, nor TemporalAccessor — or if it is a TemporalAccessor that cannot yield an Instant (e.g. a bare LocalDate, which Instant.from rejects) — this branch throws. It enforces that timestamp values are instant-like temporal objects.
Source
Thrown at seatunnel-connectors-v2/connector-aerospike/src/main/java/org/apache/seatunnel/connectors/seatunnel/aerospike/sink/AerospikeSinkWriter.java:253
throw new IllegalArgumentException("Unsupported datetime format: " + datetime);
}
}
}
private Optional<Long> tryParseDateTime(String datetime) {
try {
return Optional.of(parseDateTimeString(datetime));
} catch (DateTimeParseException e) {
return Optional.empty();
}
}
private long convertTimestampToLong(Object timestamp) {
if (timestamp instanceof TemporalAccessor) {
Instant instant = Instant.from((TemporalAccessor) timestamp);
return instant.toEpochMilli();
}
throw new IllegalArgumentException("Unsupported timestamp type: " + timestamp.getClass());
}
}
View on GitHub (pinned to cf67b549a7)
Solutions
- Ensure timestamp values are instant-like: use Instant, ZonedDateTime or OffsetDateTime instead of LocalDate/LocalTime.
- Convert the value to epoch millis upstream (e.g. in a transform) so the sink receives a Long.
- If the source only has a date, attach a zone/offset (e.g. LocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant()) before writing.
- Map the field as STRING in field_types and supply a parseable ISO-8601 string instead.
Example fix
// before LocalDate value = LocalDate.of(2026, 9, 10); // after Instant value = LocalDate.of(2026, 9, 10).atStartOfDay(ZoneId.systemDefault()).toInstant();
Defensive patterns
Strategy: type-guard
Validate before calling
boolean isWritableTimestamp(Object v) {
return v instanceof Number || v instanceof String
|| (v instanceof java.time.temporal.TemporalAccessor
&& !(v instanceof java.time.LocalDate)
&& !(v instanceof java.time.LocalTime));
} Type guard
boolean isInstantLike(Object v) {
try {
java.time.Instant.from((java.time.temporal.TemporalAccessor) v);
return true;
} catch (Exception e) {
return false;
}
} Try / catch
try {
writer.write(row);
} catch (AerospikeConnectorException e) {
if (e.getCause() instanceof IllegalArgumentException
&& e.getCause().getMessage().startsWith("Unsupported timestamp type")) {
// convert the field to epoch millis or log-and-skip
} else {
throw e;
}
} Prevention
- Use Instant/ZonedDateTime/OffsetDateTime for timestamp columns, never LocalDate/LocalTime.
- Convert timestamps to Long epoch millis in an upstream transform so the sink only sees numbers.
- Keep source column types as TIMESTAMP/BIGINT rather than DATE when the sink field is LONG.
When it happens
Trigger: A row field mapped to AerospikeDataType.LONG carries an object that is not Number/String/TemporalAccessor (falls into Long.parseLong(value.toString()) path) or carries a TemporalAccessor without zone/offset info such as LocalDate or LocalTime, making Instant.from((TemporalAccessor)) throw inside convertTimestampToLong, reached from convertValue() during write().
Common situations: Custom sources producing LocalDate/LocalTime values for timestamp columns; upstream transforms boxing timestamps into unexpected wrapper types; using DATE-typed SeaTunnel columns that get mapped to LONG but materialized as a non-instant temporal type.
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
- Sparse vector value must be a Number, but got: %s
- Expected Array type but got:
- Expected List type but got:
- Unsupported AEROSPIKE data type:
- Unsupported datetime format:
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/0e0da3db3163d999.
Report an issue: GitHub.