{"record":{"id":"31cd9d3c50d98729","repo":"apache/seatunnel","slug":"common-33-31cd9d","errorCode":"COMMON-33","errorMessage":"The datetime format '<datetime>' of field '<field>' is not supported. Please check the datetime format.","messagePattern":"The datetime format '<datetime>' of field '<field>' is not supported\\. Please check the datetime format\\.","errorType":"error_code","errorClass":"SeaTunnelRuntimeException","httpStatus":null,"severity":"error","filePath":"seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/JsonToRowConverters.java","lineNumber":313,"sourceCode":"\n    private LocalDateTime convertToLocalDateTime(JsonNode jsonNode, String fieldName) {\n        String datetimeStr = jsonNode.asText();\n\n        DateTimeFormatter dateTimeFormatter = null;\n\n        if (fieldName != null) {\n            dateTimeFormatter = fieldFormatterMap.get(fieldName);\n        }\n\n        if (dateTimeFormatter == null) {\n            dateTimeFormatter = DateTimeUtils.matchDateTimeFormatter(datetimeStr);\n            if (fieldName != null) {\n                fieldFormatterMap.put(fieldName, dateTimeFormatter);\n            }\n        }\n\n        if (dateTimeFormatter == null) {\n            throw CommonError.formatDateTimeError(datetimeStr, fieldName);\n        }\n\n        TemporalAccessor parsedTimestamp =\n                parseDateTimeWithFormatterRefresh(datetimeStr, fieldName, dateTimeFormatter);\n        LocalTime localTime = parsedTimestamp.query(TemporalQueries.localTime());\n        LocalDate localDate = parsedTimestamp.query(TemporalQueries.localDate());\n        return LocalDateTime.of(localDate, localTime);\n    }\n\n    /**\n     * Re-resolves the formatter when the cached per-field formatter no longer matches the current\n     * timestamp text. This happens when one JSON field mixes second-only and fractional-second\n     * values across rows.\n     */\n    private TemporalAccessor parseDateTimeWithFormatterRefresh(\n            String datetimeStr, String fieldName, DateTimeFormatter dateTimeFormatter) {\n        try {\n            return dateTimeFormatter.parse(datetimeStr);","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/JsonToRowConverters.java#L295-L331","documentation":"A JSON string for a TIMESTAMP field could not be parsed with the field's formatter or any auto-matched pattern, so convertToLocalDateTime throws COMMON-33 format_datetime_error naming the value and field. The converter also refreshes/retries with DateTimeUtils.matchDateTimeFormatter before giving up.","triggerScenarios":"Parsing a JSON field declared as SeaTunnel TIMESTAMP whose text (e.g. \"2024-01-05 10:00\", epoch millis as string, \"2024-01-05T10:00:00 UTC\") matches no supported datetime pattern.","commonSituations":"Producers emit datetimes without seconds or with timezone names Jackson patterns don't accept; numeric timestamps sent as strings where a datetime string is expected; locale-specific formats after a producer upgrade.","solutions":["Emit ISO-8601 datetimes from the source (yyyy-MM-dd HH:mm:ss or yyyy-MM-dd'T'HH:mm:ss)","Transform the string to a supported pattern before JSON parsing","Configure the format's datetime formatter option to match the producer's pattern","If the value is a numeric epoch, change the field type handling or convert the number to a datetime first"],"exampleFix":"// before\n{\"event_time\": \"2024-01-05 10:00\"}\n// after\n{\"event_time\": \"2024-01-05 10:00:00\"} // include seconds, standard pattern","handlingStrategy":"validation","validationCode":"java.time.LocalDateTime.parse(datetimeStr); // throws if not a supported ISO pattern","typeGuard":"static boolean isSupportedDatetime(String s) {\n    try { java.time.LocalDateTime.parse(s); return true; } catch (Exception e) { return false; }\n}","tryCatchPattern":"try {\n    row = jsonDeserializer.deserialize(bytes);\n} catch (SeaTunnelRuntimeException e) {\n    if (String.valueOf(e.getMessage()).contains(\"datetime format\")) {\n        log.warn(\"Bad TIMESTAMP value: {}\", e.getMessage());\n        return null; // or route to DLQ\n    }\n    throw e;\n}","preventionTips":["Emit ISO-8601 timestamps with seconds (yyyy-MM-dd HH:mm:ss) from producers","Convert epoch-millis numbers to datetime strings upstream if needed","Avoid timezone names; prefer fixed offsets or 'Z'","Test TIMESTAMP fields with the actual producer output format"],"tags":["json","datetime","format"],"backgroundTag":"invalid-date-format","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}