{"record":{"id":"0e0da3db3163d999","repo":"apache/seatunnel","slug":"unsupported-timestamp-type","errorCode":null,"errorMessage":"Unsupported timestamp type: ","messagePattern":"Unsupported timestamp type: ","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":253,"sourceCode":"                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());\n    }\n}\n","sourceCodeStart":235,"sourceCodeEnd":256,"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#L235-L256","documentation":"convertTimestampToLong() converts a TemporalAccessor (e.g. LocalDateTime, ZonedDateTime) timestamp value to epoch millis via Instant.from(). If the value passed for a LONG-typed field is neither a Number, String, nor TemporalAccessor — or if it is a TemporalAccessor that cannot yield an Instant (e.g. a bare LocalDate, which Instant.from rejects) — this branch throws. It enforces that timestamp values are instant-like temporal objects.","triggerScenarios":"A row field mapped to AerospikeDataType.LONG carries an object that is not Number/String/TemporalAccessor (falls into Long.parseLong(value.toString()) path) or carries a TemporalAccessor without zone/offset info such as LocalDate or LocalTime, making Instant.from((TemporalAccessor)) throw inside convertTimestampToLong, reached from convertValue() during write().","commonSituations":"Custom sources producing LocalDate/LocalTime values for timestamp columns; upstream transforms boxing timestamps into unexpected wrapper types; using DATE-typed SeaTunnel columns that get mapped to LONG but materialized as a non-instant temporal type.","solutions":["Ensure timestamp values are instant-like: use Instant, ZonedDateTime or OffsetDateTime instead of LocalDate/LocalTime.","Convert the value to epoch millis upstream (e.g. in a transform) so the sink receives a Long.","If the source only has a date, attach a zone/offset (e.g. LocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant()) before writing.","Map the field as STRING in field_types and supply a parseable ISO-8601 string instead."],"exampleFix":"// before\nLocalDate value = LocalDate.of(2026, 9, 10);\n\n// after\nInstant value = LocalDate.of(2026, 9, 10).atStartOfDay(ZoneId.systemDefault()).toInstant();","handlingStrategy":"type-guard","validationCode":"boolean isWritableTimestamp(Object v) {\n    return v instanceof Number || v instanceof String\n        || (v instanceof java.time.temporal.TemporalAccessor\n            && !(v instanceof java.time.LocalDate)\n            && !(v instanceof java.time.LocalTime));\n}","typeGuard":"boolean isInstantLike(Object v) {\n    try {\n        java.time.Instant.from((java.time.temporal.TemporalAccessor) v);\n        return true;\n    } catch (Exception e) {\n        return false;\n    }\n}","tryCatchPattern":"try {\n    writer.write(row);\n} catch (AerospikeConnectorException e) {\n    if (e.getCause() instanceof IllegalArgumentException\n            && e.getCause().getMessage().startsWith(\"Unsupported timestamp type\")) {\n        // convert the field to epoch millis or log-and-skip\n    } else {\n        throw e;\n    }\n}","preventionTips":["Use Instant/ZonedDateTime/OffsetDateTime for timestamp columns, never LocalDate/LocalTime.","Convert timestamps to Long epoch millis in an upstream transform so the sink only sees numbers.","Keep source column types as TIMESTAMP/BIGINT rather than DATE when the sink field is LONG."],"tags":["java","aerospike","timestamp","type-mismatch"],"backgroundTag":"type-mismatch","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"}