apache/seatunnel · error · SeaTunnelRuntimeException

COMMON-33

COMMON-33

Error message

The datetime format '<datetime>' of field '<field>' is not supported. Please check the datetime format.

What it means

CsvDeserializationSchema.parseTimestampTz parses a CSV field into an OffsetDateTime, first trying ISO_OFFSET_DATE_TIME and, on failure, falling back to DateTimeUtils.matchDateTimeFormatter for legacy wall-clock timestamps written without a zone offset (assumed UTC). If neither the ISO pattern nor any known fallback pattern matches, CommonError.formatDateTimeError is thrown with the value and field name. The timestamp string uses a format outside both the ISO-offset form and the supported fallback patterns.

Source

Thrown at seatunnel-formats/seatunnel-format-csv/src/main/java/org/apache/seatunnel/format/csv/CsvDeserializationSchema.java:391

                    CommonErrorCode.UNSUPPORTED_DATA_TYPE,
                    String.format(
                            "SeaTunnel can not parse this date format [%s] of field [%s]",
                            field, fieldName));
        }
        TemporalAccessor parsedTimestamp = dateTimeFormatter.parse(field);
        return LocalDateTime.of(
                parsedTimestamp.query(TemporalQueries.localDate()),
                parsedTimestamp.query(TemporalQueries.localTime()));
    }

    private OffsetDateTime parseTimestampTz(String field, String fieldName) {
        try {
            return OffsetDateTime.parse(field, DateTimeFormatter.ISO_OFFSET_DATE_TIME);
        } catch (DateTimeParseException ignored) {
            // Fallback: data written by old SeaTunnel (wall-clock, no offset).
            DateTimeFormatter fallbackFmt = DateTimeUtils.matchDateTimeFormatter(field);
            if (fallbackFmt == null) {
                throw CommonError.formatDateTimeError(field, fieldName);
            }
            TemporalAccessor ta = fallbackFmt.parse(field);
            return LocalDateTime.of(
                            ta.query(TemporalQueries.localDate()),
                            ta.query(TemporalQueries.localTime()))
                    .atOffset(ZoneOffset.UTC);
        }
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Check the failing datetime string in the error message and identify its actual pattern vs ISO offset form.
  2. Normalize the CSV timestamps to ISO-8601 with offset, e.g. '2024-01-01T10:00:00Z' or '2024-01-01T10:00:00+08:00'.
  3. If the column is epoch millis or a custom pattern, type it appropriately (BIGINT) or convert it with a transform before the CSV deserialization/consumption.
  4. If the column has no meaningful offset, use TIMESTAMP (without time zone) as the column type so the wall-clock fallback path applies instead.

Example fix

// before
row: 2024/01/01 10:00 AM  -> formatDateTimeError
// after (fix CSV cell)
row: 2024-01-01T10:00:00+08:00
// or change column type if no offset exists
column { ts = TIMESTAMP } // wall-clock fallback handled as UTC
Defensive patterns

Strategy: validation

Validate before calling

// validate a sample timestamp cell parses as ISO offset before running the job
try {
  java.time.OffsetDateTime.parse(sampleCell, java.time.format.DateTimeFormatter.ISO_OFFSET_DATE_TIME);
} catch (java.time.format.DateTimeParseException e) {
  System.err.println("Not ISO-offset datetime: " + sampleCell);
}

Try / catch

try {
  SeaTunnelRow row = deserializationSchema.deserialize(line);
} catch (org.apache.seatunnel.api.common.SeaTunnelRuntimeException e) {
  // COMMON-33: capture payload for repair/replay
  LOG.warn("Bad timestamp in CSV line: {}", e.getFormattedMessage());
}

Prevention

When it happens

Trigger: Reading a CSV column mapped to TIMESTAMP_WITH_TIME_ZONE where the cell text is neither an ISO-8601 offset datetime (e.g. '2024-01-01T10:00:00+01:00') nor one of the matched legacy datetime patterns — e.g. '2024/01/01 10:00:00 UTC', epoch millis as text, or truncated strings like '2024-01-01 10'.

Common situations: CSVs exported by tools with locale timestamp formats or non-standard zone names; numeric epoch timestamps stored in a column typed TIMESTAMP_WITH_TIME_ZONE; partially truncated timestamps from fixed-width exports; mixed formats within one column where the first rows parse but later rows fail.

Related errors


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