{"record":{"id":"5e539a37ae0db0b1","repo":"apache/seatunnel","slug":"unsupported-convert-value-getclass-to-localti-5e539a","errorCode":null,"errorMessage":"Unsupported convert ${value.getClass()} to LocalTime","messagePattern":"Unsupported convert (.+?) to LocalTime","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"seatunnel-api/src/main/java/org/apache/seatunnel/api/table/converter/BasicDataConverter.java","lineNumber":688,"sourceCode":"        if (value instanceof Time) {\n            return convertLocalTime((Time) value);\n        }\n        if (value instanceof LocalDateTime) {\n            return convertLocalTime((LocalDateTime) value);\n        }\n        if (value instanceof java.sql.Timestamp) {\n            return convertLocalTime((java.sql.Timestamp) value);\n        }\n        if (value instanceof String) {\n            return convertLocalTime((String) value);\n        }\n        if (value instanceof Number) {\n            return convertLocalTime((Number) value);\n        }\n        if (value instanceof Duration) {\n            return convertLocalTime((Duration) value);\n        }\n        throw new UnsupportedOperationException(\n                \"Unsupported convert \" + value.getClass() + \" to LocalTime\");\n    }\n\n    default LocalTime convertLocalTime(LocalDateTime value) {\n        return value.toLocalTime();\n    }\n\n    default LocalTime convertLocalTime(Time value) {\n        return value.toLocalTime();\n    }\n\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));","sourceCodeStart":670,"sourceCodeEnd":706,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/converter/BasicDataConverter.java#L670-L706","documentation":"The no-typeDefine variant of convertTime accepts Number, Duration, LocalTime-like and String values; anything else triggers UnsupportedOperationException naming the value's class. It signals the converter received a field type it has no LocalTime conversion rule for.","triggerScenarios":"Calling convert()/convertTime(Object) with e.g. java.util.Calendar, char[], or a domain object for a TIME column, where the value is not a Number, Duration, or parseable String.","commonSituations":"Custom source connectors passing raw driver objects; upstream format changes (Avro/Protobuf time logical types materialized as custom classes); accidentally passing a full timestamp object where a plain time was expected.","solutions":["Convert the value to LocalTime, Duration, Number (nanos of day), or an ISO-8601 time String before calling convert","Inspect the class named in the message and add a custom converter branch for it","Fix the schema/source mapping so the deserialized type matches the TIME column expectations"],"exampleFix":"// before\nconverter.convert(calendarObj); // throws\n// after\nLocalTime t = ((java.util.Calendar) calendarObj).toInstant().atZone(ZoneId.systemDefault()).toLocalTime();\nconverter.convert(t);","handlingStrategy":"type-guard","validationCode":"if (!(v instanceof Number) && !(v instanceof String) && !(v instanceof java.time.Duration) && !(v instanceof java.time.LocalTime)) {\n    throw new IllegalStateException(\"Unsupported time class: \" + v.getClass());\n}","typeGuard":"boolean isConvertibleToTime(Object v) {\n    return v instanceof Number || v instanceof String\n        || v instanceof java.time.Duration || v instanceof java.time.LocalTime;\n}","tryCatchPattern":"try {\n    converter.convert(value);\n} catch (UnsupportedOperationException e) {\n    LOG.warn(\"Time convert failed, class={}\", value.getClass(), e);\n    value = normalizeToTime(value);\n}","preventionTips":["Pre-normalize raw driver objects to java.time types before conversion","Cover all emitted field classes in unit tests","Re-check mappings after connector or driver upgrades"],"tags":["java","type-conversion","time","seatunnel-api"],"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"}