{"record":{"id":"f47d325f087c5a9d","repo":"apache/seatunnel","slug":"create-replication-connection-failed","errorCode":"CREATE_REPLICATION_CONNECTION_FAILED","errorMessage":"${taskContext}","messagePattern":"\\$\\{taskContext\\}","errorType":"error_code","errorClass":"SeaTunnelRuntimeException","httpStatus":null,"severity":"critical","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres/src/main/java/io/debezium/connector/postgresql/PostgresObjectUtils.java","lineNumber":121,"sourceCode":"                    throw new ConnectException(ex);\n                }\n\n                log.warn(\n                        \"Error connecting to server; will attempt retry {} of {} after {} \"\n                                + \"seconds. Exception message: {}\",\n                        retryCount,\n                        maxRetries,\n                        retryDelay.getSeconds(),\n                        ex.getMessage());\n                try {\n                    metronome.pause();\n                } catch (InterruptedException e) {\n                    log.warn(\"Connection retry sleep interrupted by exception: \" + e);\n                    Thread.currentThread().interrupt();\n                }\n            }\n        }\n        throw new SeaTunnelRuntimeException(CREATE_REPLICATION_CONNECTION_FAILED, \"\" + taskContext);\n    }\n}\n","sourceCodeStart":103,"sourceCodeEnd":124,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres/src/main/java/io/debezium/connector/postgresql/PostgresObjectUtils.java#L103-L124","documentation":"PostgresObjectUtils.createReplicationConnection gives up after exhausting all connection retries when opening a PostgreSQL logical replication connection for CDC. It wraps the failure in SeaTunnelRuntimeException with code CREATE_REPLICATION_CONNECTION_FAILED and the task context as message. Underlying causes (auth, network, slot issues) are only visible in the logged retry warnings.","triggerScenarios":"Called during Postgres CDC source initialization when establishing the logical replication connection (e.g. wal2json/decoder connection) fails repeatedly until the retry loop is exhausted.","commonSituations":"Wrong hostname/port or firewall blocking the replication port; invalid dbz username/password; user lacks REPLICATION privilege; slot already in use by another consumer; pg_hba.conf rejecting replication connections; database unreachable.","solutions":["Verify the JDBC/replication host, port and credentials are correct and the database is reachable (e.g. psql connection test).","Ensure the user has REPLICATION privilege and pg_hba.conf allows replication connections from the client host.","Check the slot is not already actively used by another replication client; drop or reuse it.","Inspect the retry WARN logs just before this error for the underlying SQLException."],"exampleFix":"// before\nurl = \"jdbc:postgresql://db-host:5432/mydb\"\nuser = \"app_user\"           // no REPLICATION privilege\n// after\nurl = \"jdbc:postgresql://db-host:5432/mydb\"\nuser = \"replication_user\"   // WITH REPLICATION, or superuser","handlingStrategy":"retry","validationCode":"pg_isready -h db-host -p 5432 && psql \"postgres://replication_user@db-host:5432/mydb\" -c 'SELECT 1;'","typeGuard":null,"tryCatchPattern":"try {\n  startCdcSource(postgresConfig);\n} catch (SeaTunnelRuntimeException e) {\n  if (e.getSeaTunnelErrorCode() == CREATE_REPLICATION_CONNECTION_FAILED) {\n    // alert ops: replication connectivity/slot/privilege problem\n  }\n}","preventionTips":["Dedicate a user WITH REPLICATION privilege for CDC.","Allow replication connections in pg_hba.conf for the runner's IP.","Pre-create and monitor replication slots to avoid contention."],"tags":["postgres","cdc","replication","connection"],"backgroundTag":"connection-refused","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}