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

  1. Ensure timestamp values are instant-like: use Instant, ZonedDateTime or OffsetDateTime instead of LocalDate/LocalTime.
  2. Convert the value to epoch millis upstream (e.g. in a transform) so the sink receives a Long.
  3. If the source only has a date, attach a zone/offset (e.g. LocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant()) before writing.
  4. 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

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


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/0e0da3db3163d999. Report an issue: GitHub.