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

TextDeserializationSchema.convert() throws this when a field mapped to SeaTunnel TIMESTAMP type cannot be matched to any datetime pattern by DateTimeUtils.matchDateTimeFormatter(field). CommonError.formatDateTimeError indicates the raw string is not a recognized datetime format.

Source

Thrown at seatunnel-formats/seatunnel-format-text/src/main/java/org/apache/seatunnel/format/text/TextDeserializationSchema.java:331

                    dateFormatter = DateUtils.matchDateFormatter(field);
                    fieldFormatterMap.put(fieldName, dateFormatter);
                }
                if (dateFormatter == null) {
                    throw CommonError.formatDateError(field, fieldName);
                }

                return dateFormatter.parse(field).query(TemporalQueries.localDate());
            case TIME:
                TemporalAccessor parsedTime = TIME_FORMAT.parse(field);
                return parsedTime.query(TemporalQueries.localTime());
            case TIMESTAMP:
                DateTimeFormatter dateTimeFormatter = fieldFormatterMap.get(fieldName);
                if (dateTimeFormatter == null) {
                    dateTimeFormatter = DateTimeUtils.matchDateTimeFormatter(field);
                    fieldFormatterMap.put(fieldName, dateTimeFormatter);
                }
                if (dateTimeFormatter == null) {
                    throw CommonError.formatDateTimeError(field, fieldName);
                }

                TemporalAccessor parsedTimestamp = dateTimeFormatter.parse(field);
                LocalTime localTime = parsedTimestamp.query(TemporalQueries.localTime());
                LocalDate localDate = parsedTimestamp.query(TemporalQueries.localDate());
                return LocalDateTime.of(localDate, localTime);
            case TIMESTAMP_TZ:
                try {
                    return OffsetDateTime.parse(field, DateTimeFormatter.ISO_OFFSET_DATE_TIME);
                } catch (DateTimeParseException ignored) {
                    // Fallback: data written by old SeaTunnel (wall-clock, no offset).
                    // Parse as LocalDateTime and attach UTC — offset info is already lost.
                    DateTimeFormatter fallbackFmt = DateTimeUtils.matchDateTimeFormatter(field);
                    if (fallbackFmt == null) {
                        throw CommonError.formatDateTimeError(field, fieldName);
                    }
                    TemporalAccessor ta = fallbackFmt.parse(field);
                    return LocalDateTime.of(

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Compare the value in the error message to the supported patterns in DateTimeUtils.matchDateTimeFormatter and normalize the data (e.g. 'yyyy-MM-dd HH:mm:ss').
  2. Change the column type to STRING and parse manually downstream.
  3. Fix the export process to emit the canonical supported datetime format.
  4. Strip timezone suffixes/fractional seconds not supported by the matcher before ingestion.
  5. Extend DateTimeUtils with the needed pattern if the format is a project requirement.

Example fix

// before (data)
2024-05-06
// after
2024-05-06 00:00:00
Defensive patterns

Strategy: validation

Validate before calling

boolean isSupportedDateTime(String v) {
    return v != null && v.matches("\\d{4}-\\d{2}-\\d{2}[ T]\\d{2}:\\d{2}:\\d{2}(.\\d+)?");
}

Try / catch

try {
    row = schema.deserialize(bytes);
} catch (Exception e) {
    log.error("Datetime field unparsable: {}", e.getMessage());
    // dead-letter or null-out the column
}

Prevention

When it happens

Trigger: Deserializing a text column mapped to TIMESTAMP where the string lacks a time part (e.g. '2024-05-06') or uses an unsupported pattern ('2024-05-06 12:00PM', epoch millis as string, ISO with 'Z' not in the matcher's list).

Common situations: CSV where datetime was exported as date-only; fractional seconds or timezone suffixes not covered by the matcher; epoch timestamps stored as text; locale-formatted datetimes from Excel exports.

Related errors


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