{"record":{"id":"07e628b026a5502c","repo":"apache/seatunnel","slug":"time-values-must-use-number-of-milliseconds-greate","errorCode":null,"errorMessage":"Time values must use number of milliseconds greater than 0 and less than 86400000000000","messagePattern":"Time values must use number of milliseconds greater than 0 and less than 86400000000000","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-api/src/main/java/org/apache/seatunnel/api/table/converter/BasicDataConverter.java","lineNumber":717,"sourceCode":"\n    default LocalTime convertLocalTime(java.sql.Timestamp value) {\n        return LocalTime.of(\n                value.getHours(), value.getMinutes(), value.getSeconds(), value.getNanos());\n    }\n\n    default LocalTime convertLocalTime(Date value) {\n        long millis = (int) (value.getTime() % TimeUnit.SECONDS.toMillis(1));\n        int nanosOfSecond = (int) (millis * TimeUnit.MILLISECONDS.toNanos(1));\n        return LocalTime.of(\n                value.getHours(), value.getMinutes(), value.getSeconds(), nanosOfSecond);\n    }\n\n    default LocalTime convertLocalTime(Duration value) {\n        Long nanos = value.toNanos();\n        if (nanos >= 0 && nanos <= TimeUnit.DAYS.toNanos(1)) {\n            return LocalTime.ofNanoOfDay(nanos);\n        } else {\n            throw new IllegalArgumentException(\n                    \"Time values must use number of milliseconds greater than 0 and less than 86400000000000\");\n        }\n    }\n\n    default LocalTime convertLocalTime(String value) {\n        return LocalTime.parse(value);\n    }\n\n    default LocalTime convertLocalTime(Number value) {\n        return LocalTime.ofSecondOfDay(value.longValue());\n    }\n\n    default LocalDate convertLocalDate(T typeDefine, Object value)\n            throws UnsupportedOperationException {\n        if (value instanceof LocalDate) {\n            return (LocalDate) value;\n        }\n        if (value instanceof Date) {","sourceCodeStart":699,"sourceCodeEnd":735,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/converter/BasicDataConverter.java#L699-L735","documentation":"convertLocalTime(Duration) treats a Duration as nanoseconds-of-day and only accepts values in [0, 1 day]. If the Duration is negative or exceeds one day, LocalTime.ofNanoOfDay would be undefined, so the converter throws IllegalArgumentException. Note the message text mentions milliseconds but the check is on nanos via TimeUnit.DAYS.toNanos(1).","triggerScenarios":"Passing a Duration longer than 24 hours (e.g. an interval spanning days) or a negative Duration to convert() for a TIME column.","commonSituations":"CDC intervals (e.g. Debezium INTERVAL types, MySQL TIME values that can exceed 24h like '850:00:00') mapped to LocalTime; sign errors producing negative durations; misinterpreting the field as an interval when it should be a timestamp.","solutions":["Clamp or modulo the Duration to a single day (duration.minusDays(duration.toDays())) when wrap-around semantics are desired","Fix the source mapping: durations >1 day usually indicate an interval/timestamp field, not a TIME field — map it to TIMESTAMP or a long instead","Guard negative durations at the source and correct upstream data or conversion math"],"exampleFix":"// before\nDuration d = Duration.ofHours(30); // from MySQL TIME '30:00:00'\nLocalTime t = converter.convert(d); // throws\n// after\nDuration d = Duration.ofHours(30);\nLocalTime t = LocalTime.ofNanoOfDay(d.toNanos() % TimeUnit.DAYS.toNanos(1));","handlingStrategy":"validation","validationCode":"java.time.Duration d = (java.time.Duration) v;\nlong nanos = d.toNanos();\nif (nanos < 0 || nanos > java.util.concurrent.TimeUnit.DAYS.toNanos(1)) {\n    throw new IllegalArgumentException(\"Duration out of day range: \" + d);\n}","typeGuard":"boolean isWithinOneDay(java.time.Duration d) {\n    long nanos = d.toNanos();\n    return nanos >= 0 && nanos <= java.util.concurrent.TimeUnit.DAYS.toNanos(1);\n}","tryCatchPattern":"try {\n    LocalTime t = converter.convert(duration);\n} catch (IllegalArgumentException e) {\n    LOG.warn(\"Duration {} not representable as LocalTime\", duration);\n    long nanos = duration.toNanos() % java.util.concurrent.TimeUnit.DAYS.toNanos(1);\n    LocalTime t = LocalTime.ofNanoOfDay(nanos); // wrap-around fallback\n}","preventionTips":["Treat durations > 24h as intervals, not times — remap to TIMESTAMP or long","Validate sign and range of Duration fields at the source","Be aware MySQL TIME can exceed 24h; plan mapping accordingly"],"tags":["java","time","value-out-of-range","duration"],"backgroundTag":"value-out-of-range","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"}