Diagnostic Queries
Symptoms
An attempt to create a replication slot used a name that already exists. PostgreSQL raises SQLSTATE 42710 (duplicate_object).
- A slot with that name already exists.
- Common when a consumer reconnects and recreates a slot.
- Slot names are unique per cluster.
What the server log shows
ERROR: replication slot "standby_1" already exists
Why PostgreSQL raises this — what the manual says
As Section 26.2.6 Replication Slots explains:
An attempt to create a replication slot reused a name that already exists; each slot name must be unique, so drop the existing slot or choose a different name before creating it.
Replication slot names are unique per cluster. Creating one whose name is already taken collides with the existing slot, so PostgreSQL reports 42710.
Common causes
- Recreating a slot that already exists.
- Two consumers configured with the same slot name.
- A leftover slot from a previous setup.
How to fix it
- Reuse the existing slot instead of recreating it.
- Drop the old slot first if it’s stale:
SELECT pg_drop_replication_slot('standby_1');(ensure no consumer needs it). - Use distinct slot names per consumer.
Related & next steps
Reference: PostgreSQL 18 Section 27.2 “Log-Shipping Standby Servers”.
Thanks — noted. This helps keep the database accurate.