apache/seatunnel · error · RuntimeException
Read the binlog offset error
Error message
Read the binlog offset error
What it means
Thrown by LsnOffsetFactory.latest() when opening the JDBC connection or computing SqlServerUtils.currentLsn() fails; the startup offset cannot be determined so the RuntimeException aborts the reader. It masks the underlying cause, so inspect the wrapped exception.
Source
Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-sqlserver/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/sqlserver/source/offset/LsnOffsetFactory.java:58
this.dialect = dialect;
}
@Override
public Offset earliest() {
return LsnOffset.INITIAL_OFFSET;
}
@Override
public Offset neverStop() {
return LsnOffset.NO_STOPPING_OFFSET;
}
@Override
public Offset latest() {
try (JdbcConnection jdbcConnection = dialect.openJdbcConnection(sourceConfig)) {
return SqlServerUtils.currentLsn((SqlServerConnection) jdbcConnection);
} catch (Exception e) {
throw new RuntimeException("Read the binlog offset error", e);
}
}
@Override
public Offset specific(Map<String, String> offset) {
return LsnOffset.valueOf(offset);
}
@Override
public Offset specific(String filename, Long position) {
throw new UnsupportedOperationException(
"not supported create new Offset by filename and position.");
}
@Override
public Offset timestamp(long timestamp) {
try (JdbcConnection jdbcConnection = dialect.openJdbcConnection(sourceConfig)) {
return SqlServerUtils.timestampToLsn(View on GitHub (pinned to cf67b549a7)
Solutions
- Check the wrapped 'e' cause — usually connection or permission failure
- Verify credentials/host/port and that the database is reachable from the job
- Grant the login permission to query the current LSN (VIEW DATABASE STATE, CDC access)
- Retry the job after any AG failover completes
- Confirm the database has CDC enabled (is_cdc_enabled = 1)
Example fix
// before
} catch (Exception e) {
throw new RuntimeException("Read the binlog offset error", e);
}
// after
} catch (Exception e) {
LOG.error("Failed to read current LSN; check connectivity and CDC permissions", e);
throw new RuntimeException("Read the binlog offset error: " + e.getMessage(), e);
} Defensive patterns
Strategy: try-catch
Validate before calling
// preflight before job start
try (Connection c = DriverManager.getConnection(url, user, pass)) {
ResultSet rs = c.createStatement().executeQuery(
"SELECT is_cdc_enabled FROM sys.databases WHERE name = DB_NAME()");
rs.next();
if (rs.getInt(1) != 1) throw new IllegalStateException("CDC not enabled on database");
} Try / catch
try {
Offset o = offsetFactory.latest();
} catch (RuntimeException e) {
Throwable cause = e.getCause();
LOG.error("Cannot determine current LSN; cause=" + (cause == null ? "?" : cause.getMessage()));
throw e;
} Prevention
- Validate credentials and network reachability before starting the job
- Enable CDC on the database and grant the login required catalog/state permissions
- Handle AG failover by restarting after topology stabilizes
- Always log the wrapped cause — this message hides the real error
When it happens
Trigger: Calling latest() when the SQL Server connection fails (bad credentials, unreachable host) or currentLsn() fails (permission denied on sys.dm/db catalog, query error, CDC not enabled on the database).
Common situations: Wrong username/password in config; login lacking VIEW DATABASE STATE / CDC access; AG failover mid-read; firewall dropping the connection during job start.
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
- Read the binlog offset error
- Read the binlog offset error
- Couldn't obtain database name
- Error to discover tables: ${e.getMessage()}
- Error to check tables: ${e.getMessage()}
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/8652995f4f1415b8.
Report an issue: GitHub.