{"record":{"id":"62aee69327e75a7a","repo":"apache/seatunnel","slug":"common-32","errorCode":"COMMON-32","errorMessage":"The date format '<date>' of field '<field>' is not supported. Please check the date format.","messagePattern":"The date format '<date>' of field '<field>' is not supported\\. Please check the date format\\.","errorType":"error_code","errorClass":"SeaTunnelRuntimeException","httpStatus":null,"severity":"error","filePath":"seatunnel-formats/seatunnel-format-csv/src/main/java/org/apache/seatunnel/format/csv/CsvDeserializationSchema.java","lineNumber":351,"sourceCode":"                                    ((SeaTunnelRowType) fieldType).getFieldType(i),\n                                    level + 1,\n                                    fieldName + \".\" + eleFieldNames[i]);\n                }\n                return new SeaTunnelRow(objects);\n            default:\n                throw CommonError.unsupportedDataType(\n                        \"SeaTunnel\", fieldType.getSqlType().toString(), fieldName);\n        }\n    }\n\n    private LocalDate parseDate(String field, String fieldName) {\n        DateTimeFormatter dateFormatter = fieldFormatterMap.get(fieldName);\n        if (dateFormatter == null) {\n            dateFormatter = DateUtils.matchDateFormatter(field);\n            fieldFormatterMap.put(fieldName, dateFormatter);\n        }\n        if (dateFormatter == null) {\n            throw CommonError.formatDateError(field, fieldName);\n        }\n\n        return dateFormatter.parse(field).query(TemporalQueries.localDate());\n    }\n\n    private LocalTime parseTime(String field) {\n        try {\n            TemporalAccessor parsedTime = TIME_FORMAT.parse(field);\n            return parsedTime.query(TemporalQueries.localTime());\n        } catch (DateTimeParseException e) {\n            throw new SeaTunnelCsvFormatException(\n                    CommonErrorCode.UNSUPPORTED_DATA_TYPE, \"Invalid time format: \" + field, e);\n        }\n    }\n\n    private LocalDateTime parseTimestamp(String field, String fieldName) {\n        DateTimeFormatter dateTimeFormatter =\n                fieldFormatterMap.computeIfAbsent(","sourceCodeStart":333,"sourceCodeEnd":369,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-formats/seatunnel-format-csv/src/main/java/org/apache/seatunnel/format/csv/CsvDeserializationSchema.java#L333-L369","documentation":"CsvDeserializationSchema.parseDate resolves a date-formatting strategy for a CSV column via DateUtils.matchDateFormatter and parses the string into a LocalDate. When no known formatter matches the string, CommonError.formatDateError is thrown, reporting the offending value and field name. The CSV date string uses a date format outside the set of patterns the CSV format recognizes.","triggerScenarios":"Reading a CSV field mapped to a DATE SeaTunnel type where the cell text is not one of the recognized date patterns (e.g. '2024/13/01' invalid month, '01-02-2024' ambiguous unsupported ordering, or free-form text in a date column) and no csv schema date_format covers it.","commonSituations":"CSV exported from a locale using a non-ISO date order (DD/MM/YYYY vs YYYY-MM-DD); Excel exports with regional date formats; a date column containing empty or placeholder values ('N/A', '0000-00-00') mistaken for dates; schema column typed DATE while data is actually a datetime string.","solutions":["Check the field value printed in the error and confirm the actual date pattern used in the CSV file.","Set the CSV format's date format option (schema-level date_format / field formatter) to match the file's pattern, e.g. 'yyyy/MM/dd' or 'dd-MM-yyyy'.","Fix the source CSV so date cells use a supported pattern (prefer ISO 'yyyy-MM-dd'), or add a transform to normalize the column before deserialization.","If the column is not reliably a date, type it as STRING in the schema and parse it downstream with an explicit formatter."],"exampleFix":"// before: CSV cell '01/02/2024' with default date_format\nschema { date = DATE }  // matchDateFormatter fails -> COMMON-32\n// after\nschema {\n  date = DATE {\n    format = \"%Y/%m/%d\"  // or fix CSV to 2024-02-01\n  }\n}","handlingStrategy":"validation","validationCode":"// validate a sample date cell against the configured format before running the job\njava.time.format.DateTimeFormatter fmt =\n    java.time.format.DateTimeFormatter.ofPattern(\"yyyy/MM/dd\");\ntry { java.time.LocalDate.parse(sampleCell, fmt); }\ncatch (java.time.format.DateTimeParseException e) {\n  throw new IllegalArgumentException(\"CSV date cell '\" + sampleCell + \"' does not match pattern\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  SeaTunnelRow row = deserializationSchema.deserialize(line);\n} catch (org.apache.seatunnel.api.common.SeaTunnelRuntimeException e) {\n  // COMMON-32: log field/payload, skip line or write to error file\n  LOG.warn(\"Bad date in CSV line: {}\", e.getFormattedMessage());\n}","preventionTips":["Explicitly configure date_format in the CSV schema instead of relying on automatic pattern matching","Standardize source files on ISO-8601 dates (yyyy-MM-dd)","Profile a sample of the CSV (e.g. awk/cut on the date column) for outliers and empty values before ingestion","Type unreliable columns as STRING and parse downstream with controlled error handling"],"tags":["csv","date","deserialization","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-14T05:17:10.506Z"}