apache/seatunnel · error · DebeziumException

Unexpected error while connecting to MySQL and looking for b

Error message

Unexpected error while connecting to MySQL and looking for binary logs: 

What it means

earliestBinlogFilename executes SHOW BINARY LOGS to list available binlog files and wraps any SQLException into this DebeziumException. The connector needs the earliest binlog name to validate or reset the starting offset; the failure prevents that lookup.

Source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/io/debezium/connector/mysql/MySqlConnection.java:403

    /**
     * Determine the earliest binlog filename that is still available in the server.
     *
     * @return the name of the earliest binlog filename, or null if there are none.
     */
    public String earliestBinlogFilename() {
        // Accumulate the available binlog filenames ...
        List<String> logNames = new ArrayList<>();
        try {
            LOGGER.info("Checking all known binlogs from MySQL");
            query(
                    "SHOW BINARY LOGS",
                    rs -> {
                        while (rs.next()) {
                            logNames.add(rs.getString(1));
                        }
                    });
        } catch (SQLException e) {
            throw new DebeziumException(
                    "Unexpected error while connecting to MySQL and looking for binary logs: ", e);
        }

        if (logNames.isEmpty()) {
            return null;
        }
        return logNames.get(0);
    }

    /**
     * Determine whether the MySQL server has the binlog_row_image set to 'FULL'.
     *
     * @return {@code true} if the server's {@code binlog_row_image} is set to {@code FULL}, or
     *     {@code false} otherwise
     */
    protected boolean isBinlogRowImageFull() {
        try {
            final String rowImage =

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Grant REPLICATION CLIENT (and REPLICATION SLAVE) to the CDC user
  2. Verify the MySQL connection and credentials
  3. Check binlog retention so logs are not purged before the connector reads them
  4. Inspect the cause SQLException for the server-side error

Example fix

// before
GRANT SELECT ON *.* TO 'cdc'@'%';
// after
GRANT SELECT, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'cdc'@'%';
Defensive patterns

Strategy: validation

Validate before calling

try (Statement s = conn.createStatement()) { ResultSet rs = s.executeQuery("SHOW BINARY LOGS"); if (!rs.next()) { throw new IllegalStateException("no binary logs available"); } }

Try / catch

catch (DebeziumException e) { logger.error("SHOW BINARY LOGS failed", e.getCause()); /* check grants/connection, then retry */ }

Prevention

When it happens

Trigger: SQLException while running SHOW BINARY LOGS inside earliestBinlogFilename — connection error, or user lacking privileges to view binary logs.

Common situations: CDC user without REPLICATION CLIENT privilege cannot list binary logs; all binlogs purged leaving an empty list (returns null rather than throwing); transient connection drops at startup.

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


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/0fa267e75dcc2120. Report an issue: GitHub.