prepared statement exists PostgreSQL Origin: Data OSI layer 7 · Application Last updated 13 Oct 2026

ERROR: prepared statement "s1" already exists (PgBouncer transaction mode)

Named prepared statements collided — typically because PgBouncer in transaction pooling mode hands connections between clients.

Exact message you may see prepared statement already existsprepared statement does not exist
Seen on: PostgreSQL

Meaning

In transaction mode, a client’s next transaction may run on a different server connection where its prepared statements don’t exist (or another client’s do). PgBouncer 1.21+ supports prepared statements with max_prepared_statements.

Common causes

  • PgBouncer transaction pooling with drivers using named prepared statements
  • Supabase/Neon poolers in transaction mode

⚡ Quick fix

  1. Upgrade PgBouncer and set max_prepared_statements
  2. Disable prepared statements in the driver (Prisma: ?pgbouncer=true; JDBC: prepareThreshold=0)
  3. Use session pooling for that client

Detailed fix by platform

PostgreSQL

  1. postgresql://…@pooler:6543/db?pgbouncer=true

How to diagnose

  1. Pooler — Transaction mode?
  2. Driver — Uses named statements?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Data. Errors that are often confused with or caused by this one (click to open):

08P01 — ERROR: bind message supplies 2 parameters, but prepared statement requires 1 (PostgreSQL)08P012BP01 — ERROR: cannot drop table x because other objects depend on it (PostgreSQL)2BP0142701 — ERROR: column "x" of relation "y" already exists (PostgreSQL)4270142703 — PostgreSQL: ERROR: column "x" does not exist (PostgreSQL)4270357014 — ERROR: canceling statement due to statement timeout (PostgreSQL)57014HikariCP timeout — HikariPool-1 - Connection is not available, request timed out after 30000ms (Java)HikariCP timeoutpool timeout — Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. All pooled connections were in use and max pool size was reached. (SQL)pool timeoutprepared …

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.