apache/seatunnel · error · SeaTunnelRuntimeException

READ_COMMITTED_OFFSET_FAILED

READ_COMMITTED_OFFSET_FAILED

Error message

Could not read PostgreSQL replication slot '${slotName}'. Verify that the slot still exists and is not being dropped.

What it means

LsnOffsetFactory.committedOffset() queries pg_replication_slots for the confirmed_flush_lsn of the configured slot and throws a SeaTunnelRuntimeException with code READ_COMMITTED_OFFSET_FAILED when the lookup fails unexpectedly (SQL error, connection drop, etc.). It tells the user to verify the replication slot still exists, since a missing or dropped slot breaks offset recovery.

Source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/postgres/source/offset/LsnOffsetFactory.java:90

    @Override
    public Offset committedOffset() {
        String slotName = sourceConfig.getDbzConfiguration().getString("slot.name");
        try (JdbcConnection jdbcConnection = dialect.openJdbcConnection(sourceConfig)) {
            try (PreparedStatement statement =
                    jdbcConnection
                            .connection()
                            .prepareStatement(
                                    "SELECT confirmed_flush_lsn::text, active_pid FROM pg_replication_slots WHERE slot_name = ?")) {
                statement.setString(1, slotName);
                try (ResultSet resultSet = statement.executeQuery()) {
                    return readCommittedOffset(resultSet, slotName);
                }
            }
        } catch (SeaTunnelRuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new SeaTunnelRuntimeException(
                    PostgresConnectorErrorCode.READ_COMMITTED_OFFSET_FAILED,
                    String.format(
                            "Could not read PostgreSQL replication slot '%s'. Verify that the slot still exists and is not being dropped.",
                            slotName),
                    e);
        }
    }

    static LsnOffset readCommittedOffset(ResultSet resultSet, String slotName) throws SQLException {
        if (!resultSet.next()) {
            throw invalidReplicationSlot(
                    slotName, "does not exist; create the logical replication slot first");
        }
        Object activePid = resultSet.getObject(2);
        if (activePid != null) {
            throw invalidReplicationSlot(
                    slotName,
                    String.format(

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Check `SELECT slot_name, active, confirmed_flush_lsn FROM pg_replication_slots;` on the database to confirm the slot exists.
  2. Recreate the slot or start a new job with a fresh slot name if it was dropped (data since the last LSN is lost).
  3. Fix `slot.name` in the source config if it is misspelled.
  4. Grant the replication user permission to query pg_replication_slots and resolve any underlying connection errors from the cause.
Defensive patterns

Strategy: validation

Validate before calling

// Run before job start
SELECT slot_name, active, confirmed_flush_lsn FROM pg_replication_slots WHERE slot_name = '<slot.name>';

Try / catch

try {
    offsetFactory.committedOffset();
} catch (SeaTunnelRuntimeException e) {
    if (e.getErrorCode() == PostgresConnectorErrorCode.READ_COMMITTED_OFFSET_FAILED) {
        // recreate slot or fail fast with clear ops message
    }
}

Prevention

When it happens

Trigger: Reading the committed offset at startup/restart when: the slot named by `slot.name` was dropped (manually or by the DB due to `max_slot_wal_keep_size`), the query on pg_replication_slots throws, or the JDBC connection fails mid-query. A plain SeaTunnelRuntimeException is rethrown unchanged; all other exceptions are wrapped.

Common situations: Slots dropped by DBAs to free WAL disk space; slot removed because the job was down past wal_keep_size; typo in slot.name; insufficient privilege to read pg_replication_slots.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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