Supabase · infra · fg-0196

prepared statement already exists errors when connecting to Supabase through the pooler on port 6543

If you see prepared statement "s0" already exists, the cause and the fix for Supabase are below, last verified 2026-10-15.

Verified Oct 2026trust 50/100
Symptom
prepared statement "s0" already existsErrors appear only under concurrent load, not in local testspostgres.js queries hang or return rows meant for another query
Cause
Transaction mode hands the connection back to the pool after each transaction, so per-session state such as prepared statements and pipelined queries leaks between clients. Most drivers prepare statements by default.
Fix
Turn off prepared statements in the driver when using port 6543, or use session mode or a direct connection for code that needs them, including migrations.
Apply
# Prisma DATABASE_URL="postgres://...pooler.supabase.com:6543/postgres?pgbouncer=true" DIRECT_URL="postgres://...pooler.supabase.com:5432/postgres" // postgres.js / Drizzle const sql = postgres(process.env.DATABASE_URL, { prepare: false });
Affected
Supabase Supavisor transaction mode (port 6543) with Prisma, postgres.js, Drizzle, asyncpg, JDBC
Sources

Last verified 2026-10-15 · Confirmed by 0 builders

Related traps

Have your agent know this before it fails

$ /plugin marketplace add getfootgun/footgun
$ /plugin install footgun@footgun