apache/seatunnel · error · IllegalArgumentException
Unsupported datetime format:
Error message
Unsupported datetime format:
What it means
parseDateTimeString() converts a datetime string to epoch milliseconds by first trying LocalDateTime.parse (ISO-8601 local date-time) and then Instant.parse (ISO-8601 instant, requires 'Z' or offset). If both attempts throw DateTimeParseException, it throws this IllegalArgumentException. The connector only accepts these two ISO-8601 formats for LONG-typed fields fed with datetime strings.
Source
Thrown at seatunnel-connectors-v2/connector-aerospike/src/main/java/org/apache/seatunnel/connectors/seatunnel/aerospike/sink/AerospikeSinkWriter.java:235
}
throw new IllegalArgumentException(
"Expected List type but got: " + value.getClass());
default:
throw new IllegalArgumentException("Unsupported AEROSPIKE data type: " + dataType);
}
}
private long parseDateTimeString(String datetime) {
try {
return LocalDateTime.parse(datetime)
.atZone(ZoneId.systemDefault())
.toInstant()
.toEpochMilli();
} catch (DateTimeParseException e) {
try {
return Instant.parse(datetime).toEpochMilli();
} catch (DateTimeParseException ex) {
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
- Normalize the datetime string to ISO-8601 before writing: 'yyyy-MM-ddTHH:mm:ss' for LocalDateTime.parse or 'yyyy-MM-ddTHH:mm:ssZ' for Instant.parse.
- Pre-convert the datetime to epoch milliseconds (a plain numeric string or number) so the LONG branch parses it as a number instead of a datetime.
- Change the field's type in field_types to STRING to store the raw value rather than converting to a timestamp.
- Add a transform (e.g. a custom SeaTunnel transform) that reformats the datetime field upstream of the Aerospike sink.
Example fix
// before (value in row) "10/09/2026 14:30:00" // after "2026-09-10T14:30:00" // or "2026-09-10T14:30:00Z"
Defensive patterns
Strategy: validation
Validate before calling
boolean isParseableDatetime(String s) {
try { java.time.LocalDateTime.parse(s); return true; }
catch (java.time.format.DateTimeParseException ignored) {
try { java.time.Instant.parse(s); return true; }
catch (java.time.format.DateTimeParseException e) { return false; }
}
} Try / catch
try {
writer.write(row);
} catch (AerospikeConnectorException e) {
if (e.getCause() instanceof IllegalArgumentException
&& e.getCause().getMessage().startsWith("Unsupported datetime format")) {
// normalize or skip the offending record
} else {
throw e;
}
} Prevention
- Emit datetime strings strictly in ISO-8601 ('2026-09-10T14:30:00' or '2026-09-10T14:30:00Z').
- Prefer sending epoch millis (numeric) for LONG-typed fields instead of datetime strings.
- Note bare dates ('2026-09-10') are rejected; include a time component.
- Pre-format datetimes in an upstream transform rather than relying on the sink to parse arbitrary formats.
When it happens
Trigger: Writing a row where a field is mapped to AerospikeDataType.LONG but the value is a String in a non-ISO-8601 format (e.g. 'yyyy/MM/dd HH:mm:ss', epoch string is fine but '10-09-2026' is not), so tryParseDateTime -> parseDateTimeString fails both parse attempts.
Common situations: Source data with locale-specific or custom datetime formats (common from CSV/log files); timestamps with only a date ('2026-09-10') which LocalDateTime.parse rejects; non-UTC offsets written in non-ISO style; users assuming arbitrary formats will be auto-detected.
Related errors
- Unsupported AEROSPIKE data type:
- Unsupported timestamp type:
- Value is not a BSON date or timestamp
- Failed to parse OffsetDateTime value: (class: )
- Unable to parse OffsetDateTime from string:
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/aaf6cf4551bc4805.
Report an issue: GitHub.