{"record":{"id":"aaf6cf4551bc4805","repo":"apache/seatunnel","slug":"unsupported-datetime-format","errorCode":null,"errorMessage":"Unsupported datetime format: ","messagePattern":"Unsupported datetime format: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-aerospike/src/main/java/org/apache/seatunnel/connectors/seatunnel/aerospike/sink/AerospikeSinkWriter.java","lineNumber":235,"sourceCode":"                }\n                throw new IllegalArgumentException(\n                        \"Expected List type but got: \" + value.getClass());\n            default:\n                throw new IllegalArgumentException(\"Unsupported AEROSPIKE data type: \" + dataType);\n        }\n    }\n\n    private long parseDateTimeString(String datetime) {\n        try {\n            return LocalDateTime.parse(datetime)\n                    .atZone(ZoneId.systemDefault())\n                    .toInstant()\n                    .toEpochMilli();\n        } catch (DateTimeParseException e) {\n            try {\n                return Instant.parse(datetime).toEpochMilli();\n            } catch (DateTimeParseException ex) {\n                throw new IllegalArgumentException(\"Unsupported datetime format: \" + datetime);\n            }\n        }\n    }\n\n    private Optional<Long> tryParseDateTime(String datetime) {\n        try {\n            return Optional.of(parseDateTimeString(datetime));\n        } catch (DateTimeParseException e) {\n            return Optional.empty();\n        }\n    }\n\n    private long convertTimestampToLong(Object timestamp) {\n        if (timestamp instanceof TemporalAccessor) {\n            Instant instant = Instant.from((TemporalAccessor) timestamp);\n            return instant.toEpochMilli();\n        }\n        throw new IllegalArgumentException(\"Unsupported timestamp type: \" + timestamp.getClass());","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-aerospike/src/main/java/org/apache/seatunnel/connectors/seatunnel/aerospike/sink/AerospikeSinkWriter.java#L217-L253","documentation":"parseDateTimeString() converts a datetime string to epoch milliseconds by first trying LocalDateTime.parse (ISO-8601 local date-time) and then Instant.parse (ISO-8601 instant, requires 'Z' or offset). If both attempts throw DateTimeParseException, it throws this IllegalArgumentException. The connector only accepts these two ISO-8601 formats for LONG-typed fields fed with datetime strings.","triggerScenarios":"Writing a row where a field is mapped to AerospikeDataType.LONG but the value is a String in a non-ISO-8601 format (e.g. 'yyyy/MM/dd HH:mm:ss', epoch string is fine but '10-09-2026' is not), so tryParseDateTime -> parseDateTimeString fails both parse attempts.","commonSituations":"Source data with locale-specific or custom datetime formats (common from CSV/log files); timestamps with only a date ('2026-09-10') which LocalDateTime.parse rejects; non-UTC offsets written in non-ISO style; users assuming arbitrary formats will be auto-detected.","solutions":["Normalize the datetime string to ISO-8601 before writing: 'yyyy-MM-ddTHH:mm:ss' for LocalDateTime.parse or 'yyyy-MM-ddTHH:mm:ssZ' for Instant.parse.","Pre-convert the datetime to epoch milliseconds (a plain numeric string or number) so the LONG branch parses it as a number instead of a datetime.","Change the field's type in field_types to STRING to store the raw value rather than converting to a timestamp.","Add a transform (e.g. a custom SeaTunnel transform) that reformats the datetime field upstream of the Aerospike sink."],"exampleFix":"// before (value in row)\n\"10/09/2026 14:30:00\"\n\n// after\n\"2026-09-10T14:30:00\"  // or \"2026-09-10T14:30:00Z\"","handlingStrategy":"validation","validationCode":"boolean isParseableDatetime(String s) {\n    try { java.time.LocalDateTime.parse(s); return true; }\n    catch (java.time.format.DateTimeParseException ignored) {\n        try { java.time.Instant.parse(s); return true; }\n        catch (java.time.format.DateTimeParseException e) { return false; }\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    writer.write(row);\n} catch (AerospikeConnectorException e) {\n    if (e.getCause() instanceof IllegalArgumentException\n            && e.getCause().getMessage().startsWith(\"Unsupported datetime format\")) {\n        // normalize or skip the offending record\n    } else {\n        throw e;\n    }\n}","preventionTips":["Emit datetime strings strictly in ISO-8601 ('2026-09-10T14:30:00' or '2026-09-10T14:30:00Z').","Prefer sending epoch millis (numeric) for LONG-typed fields instead of datetime strings.","Note bare dates ('2026-09-10') are rejected; include a time component.","Pre-format datetimes in an upstream transform rather than relying on the sink to parse arbitrary formats."],"tags":["java","aerospike","datetime","parsing"],"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"}