apache/seatunnel · error · RuntimeException
Read the binlog offset error
Error message
Read the binlog offset error
What it means
BinlogOffsetFactory.earliest() opens a JDBC connection to MySQL via the dialect to read the earliest available binlog offset (MySqlConnectionUtils.earliestBinlogOffset). Any failure opening the connection or querying binlog coordinates is rethrown as a RuntimeException('Read the binlog offset error').
Source
Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/source/offset/BinlogOffsetFactory.java:49
/** An offset factory class create {@link BinlogOffset} instance. */
public class BinlogOffsetFactory extends OffsetFactory {
private final MySqlSourceConfig sourceConfig;
private final JdbcDataSourceDialect dialect;
public BinlogOffsetFactory(
MySqlSourceConfigFactory configFactory, JdbcDataSourceDialect dialect) {
this.sourceConfig = configFactory.create(0);
this.dialect = dialect;
}
@Override
public Offset earliest() {
try (JdbcConnection jdbcConnection = dialect.openJdbcConnection(sourceConfig)) {
return MySqlConnectionUtils.earliestBinlogOffset(jdbcConnection);
} catch (Exception e) {
throw new RuntimeException("Read the binlog offset error", e);
}
}
@Override
public Offset neverStop() {
return BinlogOffset.NO_STOPPING_OFFSET;
}
@Override
public Offset latest() {
try (JdbcConnection jdbcConnection = dialect.openJdbcConnection(sourceConfig)) {
return MySqlConnectionUtils.currentBinlogOffset(jdbcConnection);
} catch (Exception e) {
throw new RuntimeException("Read the binlog offset error", e);
}
}
@OverrideView on GitHub (pinned to cf67b549a7)
Solutions
- Check the root cause ('Caused by') for connection vs. SQL errors and fix connectivity or credentials first
- Grant the CDC user REPLICATION CLIENT (and REPLICATION SLAVE) privileges and verify with a manual mysql client connection
- Confirm hostname/port/SSL settings and that MySQL is reachable from the SeaTunnel node
- Retry if the failure was a transient network blip — job submission can be re-run
Example fix
// before url = "jdbc:mysql://localhost:3306" // after (correct host, and a user with REPLICATION privileges) url = "jdbc:mysql://mysql-prod:3306" username = "sea_cdc" password = "***"
Defensive patterns
Strategy: retry
Validate before calling
// before submitting, verify connectivity and privileges
try (Connection c = DriverManager.getConnection(url, user, pass)) {
try (Statement s = c.createStatement(); ResultSet r = s.executeQuery("SHOW MASTER STATUS")) {
if (!r.next()) throw new IllegalStateException("CDC user cannot read binlog status");
}
} Try / catch
try {
offsetFactory.earliest();
} catch (RuntimeException e) {
LOG.error("Failed to read binlog offset (check JDBC config/privileges): {}", e.getCause(), e);
throw e;
} Prevention
- Verify JDBC connectivity with a mysql client from the SeaTunnel host
- Grant REPLICATION CLIENT/SLAVE to the CDC user
- Include retries with backoff around job submission for transient DB issues
- Check 'Caused by' first — the wrapper message hides the real cause
When it happens
Trigger: startup.mode='earliest' triggering BinlogOffsetFactory.earliest(); underlying cause typically SQLException/SQLTimeout from openJdbcConnection or the binlog coordinate query.
Common situations: Wrong hostname/port or credentials in the source config; MySQL user lacking REPLICATION CLIENT/SLAVE privileges; network/firewall blocking 3306; server binlogs purged so earliest coordinates can't be computed; MySQL down.
Understand the failure class
Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.
Related errors
- Unexpected error while connecting to MySQL and looking for b
- Unexpected error while connecting to MySQL and looking at BI
- Unexpected error while connecting to MySQL and looking at BI
- Timed out after <actualSeconds> seconds while waiting to con
- Error reading MySQL variables: ${e.getMessage()}
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/f8ea19dbdd2a3654.
Report an issue: GitHub.