apache/seatunnel · critical · DebeziumException

Creation of replication slot failed

Error message

Creation of replication slot failed

What it means

During PostgresSourceFetchTaskContext.configure, creating the Debezium replication slot failed. Notably, when PostgreSQL returns SQLState 42710 (duplicate object — slot already exists), the code only logs a warning and continues; any other SQL error is rethrown as a DebeziumException 'Creation of replication slot failed'.

Source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/postgres/source/reader/PostgresSourceFetchTaskContext.java:238

                            PostgresObjectUtils.createReplicationConnection(
                                    this.taskContext,
                                    dataConnection,
                                    snapshotter.shouldSnapshot(),
                                    connectorConfig);
                    if (slotInfo == null) {
                        try {
                            replicationConnection.createReplicationSlot().orElse(null);
                        } catch (SQLException ex) {
                            String message = "Creation of replication slot failed";
                            // PostgreSQL errors all have a 5-character SQLSTATE code, following the
                            // SQL standard specification
                            // https://www.postgresql.org/docs/current/errcodes-appendix.html
                            if ("42710".equals(ex.getSQLState())) {
                                message +=
                                        "; when setting up multiple connectors for the same database host, please make sure to use a distinct replication slot name for each.";
                                log.warn(message);
                            } else {
                                throw new DebeziumException(message, ex);
                            }
                        }
                    }
                }
            }

            try {
                dataConnection.commit();
            } catch (SQLException e) {
                throw new DebeziumException(e);
            }

            this.queue =
                    new ChangeEventQueue.Builder<DataChangeEvent>()
                            .pollInterval(connectorConfig.getPollInterval())
                            .maxBatchSize(connectorConfig.getMaxBatchSize())
                            .maxQueueSize(queueSize)
                            .maxQueueSizeInBytes(connectorConfig.getMaxQueueSizeInBytes())

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Read the wrapped cause (`ex`) for the exact PostgreSQL error and SQLState.
  2. Increase `max_replication_slots` on the PostgreSQL server if it is exhausted.
  3. Grant the user REPLICATION privilege and ensure you connect to the primary.
  4. If you see the 42710 warning path, it is benign — but give each connector a distinct `slot.name` when sharing a database host.

Example fix

// before
.slot.name("my_slot")   // shared by multiple jobs on same host
// after
.slot.name("seatunnel_job_a_slot")  // unique per connector/job
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-flight: user privilege + slot headroom
SELECT rolreplication FROM pg_roles WHERE rolname = current_user;
SHOW max_replication_slots;

Try / catch

try {
    context.configure(...);
} catch (DebeziumException e) {
    if (e.getCause() instanceof SQLException) {
        String sqlState = ((SQLException) e.getCause()).getSQLState();
        // 42710 is tolerated (slot exists); otherwise fix privileges/slots
    }
}

Prevention

When it happens

Trigger: configure() creating the logical replication slot when: the database user lacks REPLICATION privilege, max_replication_slots is exhausted, the connection is to a replica, or the DB rejects CREATE_REPLICATION_SLOT for another reason (not 42710).

Common situations: max_replication_slots too low on the server; connecting with a non-replication role; using a standby/replica that disallows logical slots; transient network failure during slot creation.

Related errors


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