apache/seatunnel · warning · RuntimeException
Could not read MySQL TIME value as UTF-8
Error message
Could not read MySQL TIME value as UTF-8
What it means
readTimeField decodes a MySQL TIME column read as a byte blob, converting it to a UTF-8 string for MySqlValueConverters.stringToDuration. If the JVM does not support the 'UTF-8' encoding name (essentially never in practice), UnsupportedEncodingException is logged and rethrown as RuntimeException.
Source
Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/source/reader/fetch/scan/MySqlSnapshotSplitReadTask.java:326
}
}
/**
* As MySQL connector/J implementation is broken for MySQL type "TIME" we have to use a
* binary-ish workaround. https://issues.jboss.org/browse/DBZ-342
*/
private Object readTimeField(ResultSet rs, int fieldNo) throws SQLException {
Blob b = rs.getBlob(fieldNo);
if (b == null) {
return null; // Don't continue parsing time field if it is null
}
try {
return MySqlValueConverters.stringToDuration(
new String(b.getBytes(1, (int) (b.length())), "UTF-8"));
} catch (UnsupportedEncodingException e) {
LOG.error("Could not read MySQL TIME value as UTF-8");
throw new RuntimeException(e);
}
}
/**
* In non-string mode the date field can contain zero in any of the date part which we need to
* handle as all-zero.
*/
private Object readDateField(ResultSet rs, int fieldNo, Column column, Table table)
throws SQLException {
Blob b = rs.getBlob(fieldNo);
if (b == null) {
return null; // Don't continue parsing date field if it is null
}
try {
return MySqlValueConverters.stringToLocalDate(
new String(b.getBytes(1, (int) (b.length())), "UTF-8"), column, table);
} catch (UnsupportedEncodingException e) {View on GitHub (pinned to cf67b549a7)
Solutions
- Use a standard JVM (JDK 8+) where UTF-8 is always supported
- Replace the literal with StandardCharsets.UTF_8 to eliminate the checked exception path
Example fix
// before return MySqlValueConverters.stringToDuration(new String(b.getBytes(1, (int) (b.length())), "UTF-8")); // after return MySqlValueConverters.stringToDuration(new String(b.getBytes(1, (int) (b.length())), java.nio.charset.StandardCharsets.UTF_8));
Defensive patterns
Strategy: validation
Prevention
- Run SeaTunnel on a standard JDK 8+ JVM
- Library-side: use StandardCharsets.UTF_8 to remove the path
When it happens
Trigger: Calling readField on a TIME column whose value is fetched as bytes, and new String(..., "UTF-8") throws UnsupportedEncodingException.
Common situations: Practically impossible on standard JVMs (UTF-8 is mandated); only seen with a broken/non-standard JRE or unusual CharsetProvider configuration.
Understand the failure class
Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.
Related errors
- Error reading MySQL variables:
- Unexpected error while connecting to MySQL and looking at GT
- Unexpected error while connecting to MySQL and looking at gt
- Unexpected error while connecting to MySQL and looking at pr
- Unexpected error while connecting to MySQL and looking for b
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/e7817808af74ddb8.
Report an issue: GitHub.