{"record":{"id":"5a049d246e156ee5","repo":"apache/seatunnel","slug":"creation-of-replication-slot-failed","errorCode":null,"errorMessage":"Creation of replication slot failed","messagePattern":"Creation of replication slot failed","errorType":"exception","errorClass":"DebeziumException","httpStatus":null,"severity":"critical","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/postgres/source/reader/PostgresSourceFetchTaskContext.java","lineNumber":238,"sourceCode":"                            PostgresObjectUtils.createReplicationConnection(\n                                    this.taskContext,\n                                    dataConnection,\n                                    snapshotter.shouldSnapshot(),\n                                    connectorConfig);\n                    if (slotInfo == null) {\n                        try {\n                            replicationConnection.createReplicationSlot().orElse(null);\n                        } catch (SQLException ex) {\n                            String message = \"Creation of replication slot failed\";\n                            // PostgreSQL errors all have a 5-character SQLSTATE code, following the\n                            // SQL standard specification\n                            // https://www.postgresql.org/docs/current/errcodes-appendix.html\n                            if (\"42710\".equals(ex.getSQLState())) {\n                                message +=\n                                        \"; when setting up multiple connectors for the same database host, please make sure to use a distinct replication slot name for each.\";\n                                log.warn(message);\n                            } else {\n                                throw new DebeziumException(message, ex);\n                            }\n                        }\n                    }\n                }\n            }\n\n            try {\n                dataConnection.commit();\n            } catch (SQLException e) {\n                throw new DebeziumException(e);\n            }\n\n            this.queue =\n                    new ChangeEventQueue.Builder<DataChangeEvent>()\n                            .pollInterval(connectorConfig.getPollInterval())\n                            .maxBatchSize(connectorConfig.getMaxBatchSize())\n                            .maxQueueSize(queueSize)\n                            .maxQueueSizeInBytes(connectorConfig.getMaxQueueSizeInBytes())","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/postgres/source/reader/PostgresSourceFetchTaskContext.java#L220-L256","documentation":"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'.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Read the wrapped cause (`ex`) for the exact PostgreSQL error and SQLState.","Increase `max_replication_slots` on the PostgreSQL server if it is exhausted.","Grant the user REPLICATION privilege and ensure you connect to the primary.","If you see the 42710 warning path, it is benign — but give each connector a distinct `slot.name` when sharing a database host."],"exampleFix":"// before\n.slot.name(\"my_slot\")   // shared by multiple jobs on same host\n// after\n.slot.name(\"seatunnel_job_a_slot\")  // unique per connector/job","handlingStrategy":"try-catch","validationCode":"// Pre-flight: user privilege + slot headroom\nSELECT rolreplication FROM pg_roles WHERE rolname = current_user;\nSHOW max_replication_slots;","typeGuard":null,"tryCatchPattern":"try {\n    context.configure(...);\n} catch (DebeziumException e) {\n    if (e.getCause() instanceof SQLException) {\n        String sqlState = ((SQLException) e.getCause()).getSQLState();\n        // 42710 is tolerated (slot exists); otherwise fix privileges/slots\n    }\n}","preventionTips":["Use distinct replication slot names per connector per host","Ensure the DB user has REPLICATION privilege","Keep max_replication_slots above the number of concurrent CDC jobs","Always connect to the primary for logical replication"],"tags":["postgresql","cdc","replication-slot","debezium","privilege"],"backgroundTag":"database-write-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}