{"record":{"id":"79e3cd6ec114d57a","repo":"apache/seatunnel","slug":"unable-to-parse-offsetdatetime-from-string","errorCode":null,"errorMessage":"Unable to parse OffsetDateTime from string: ","messagePattern":"Unable to parse OffsetDateTime from string: ","errorType":"exception","errorClass":"DateTimeParseException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/utils/JdbcFieldTypeUtils.java","lineNumber":295,"sourceCode":"        }\n        // Try parsing as standard ISO-8601 OffsetDateTime\n        OffsetDateTime directParsed = tryParseOffsetDateTime(trimmed);\n        if (directParsed != null) {\n            return directParsed;\n        }\n        // Normalize common relaxed forms and try again\n        String normalized = normalizeOffsetDateTimeString(trimmed);\n        OffsetDateTime normalizedParsed = tryParseOffsetDateTime(normalized);\n        if (normalizedParsed != null) {\n            return normalizedParsed;\n        }\n        // Finally, try parsing as ZonedDateTime and convert to OffsetDateTime\n        OffsetDateTime zonedParsed = tryParseZonedDateTime(trimmed);\n        if (zonedParsed != null) {\n            return zonedParsed;\n        }\n\n        throw new DateTimeParseException(\n                \"Unable to parse OffsetDateTime from string: \" + str, trimmed, 0);\n    }\n\n    private static OffsetDateTime tryParseOffsetDateTime(String value) {\n        try {\n            return OffsetDateTime.parse(value);\n        } catch (DateTimeParseException ignore) {\n            return null;\n        }\n    }\n\n    private static OffsetDateTime tryParseZonedDateTime(String value) {\n        try {\n            return ZonedDateTime.parse(value).toOffsetDateTime();\n        } catch (DateTimeParseException ignore) {\n            return null;\n        }\n    }","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/utils/JdbcFieldTypeUtils.java#L277-L313","documentation":"parseOffsetDateTimeFromString attempts ISO OffsetDateTime parsing, then several fallback formats, then ZonedDateTime conversion. If none succeed it throws DateTimeParseException with the input string. This is the low-level parsing failure usually surfaced (wrapped) by getOffsetDateTime.","triggerScenarios":"getOffsetDateTime passes a trimmed string that matches no supported pattern: missing timezone offset, non-ISO separators/formats, localized month names, epoch-style numbers, etc.","commonSituations":"Vendor-specific timestamp text formats (MySQL, Oracle) reaching the parser; values like '2024-01-01 10:00:00.0' with no zone; user data stored as strings in VARCHAR columns being read as timestamps.","solutions":["Inspect the message to see the exact string that failed, then normalize the format in SQL (STR_TO_DATE / TO_TIMESTAMP) before it reaches the reader","Cast or map the column to a native timestamp type so no string parsing occurs","Upgrade SeaTunnel for broader format support, or contribute/extend tryParse* methods for the needed format","If the data has no zone info, decide an offset explicitly and format with one (e.g. append '+00:00')"],"exampleFix":"// before\nSELECT created_at FROM logs // '2024-01-01 10:00:00'\n// after\nSELECT DATE_FORMAT(created_at, '%Y-%m-%dT%H:%i:%s+00:00') AS created_at FROM logs // ISO-8601 with offset","handlingStrategy":"type-guard","validationCode":"try {\n  java.time.OffsetDateTime.parse(value.trim());\n} catch (java.time.format.DateTimeParseException e) {\n  // normalize or reject before sending to connector\n  value = java.time.LocalDateTime.parse(value.trim()).atOffset(java.time.ZoneOffset.UTC).toString();\n}","typeGuard":"boolean isIsoOffsetDateTime(String s) {\n  try { java.time.OffsetDateTime.parse(s.trim()); return true; }\n  catch (Exception e) { return false; }\n}","tryCatchPattern":"try {\n  OffsetDateTime odt = parse(str);\n} catch (DateTimeParseException e) {\n  log.error(\"Unparseable timestamp string '{}' — normalize format upstream\", str);\n}","preventionTips":["Store temporal values in native timestamp columns, not VARCHAR","Use ISO-8601 with explicit offset when strings are unavoidable","Normalize vendor formats in SQL before reading"],"tags":["jdbc","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"}