Neon says a prepared statement already exists. Here is why
Neon's connection pooler runs PgBouncer in transaction mode: a connection is returned to the pool as soon as your transaction finishes, so the next query from the same client can land on a different backend connection. A prepared statement your ORM cached against one backend can then collide with, or be missing from, the next one it is handed — the same transaction-mode behavior documented on Supabase's own pooler (see /supabase-prepared-statement-already-exists), since it is a PgBouncer trait rather than something unique to either vendor's setup of it.
Last checked November 19, 2026.
Why it happens
Neon's own connection-pooling docs describe the pooler as PgBouncer running in transaction mode, which hands out a different backend connection on nearly every call. Prepared statements (Postgres named queries) live on one physical connection; once the pool reassigns which backend you get, a statement name your ORM already created can either be missing on the new backend or already taken by a different client's statement of the same generated name.
Sources: Neon: Connection pooling
The fix
Prisma's own error reference documents the setting for exactly this: add ?pgbouncer=true to the pooled connection string used for the application's DATABASE_URL. That tells Prisma's query engine to send unnamed prepared statements instead of caching named ones against a connection that might not be there on the next call.
- Keep a second, non-pooled connection string as a separate directUrl (Prisma schema datasource block) for schema migrations — Prisma Migrate needs a direct connection and is not supported through the pooler.
- Other drivers follow the same shape with their own setting: disable the client-side prepared-statement cache rather than fighting the pool (the equivalent of Supabase’s documented prepare: false for Postgres.js/Drizzle, statement_cache_size=0 for asyncpg, prepareThreshold=0 for JDBC).
DATABASE_URL="postgres://<user>:<password>@ep-xxx.<region>.aws.neon.tech/neondb?pgbouncer=true"
DIRECT_URL="postgres://<user>:<password>@ep-xxx.<region>.aws.neon.tech/neondb"Sources: Prisma: Error message reference, Neon: Connection pooling
If you are evaluating a different Postgres host
Every Scribase project also runs behind a pooler for application traffic by default, so the same driver-side setting (pgbouncer=true or its equivalent) is the fix regardless of which Postgres you point your ORM at — this is how PgBouncer transaction mode behaves everywhere it is used, not a Neon-only quirk.
If the real goal is leaving Neon rather than just fixing this one error, scribase-migrate moves the schema, data and auth.users in one run, then verifies row counts.
npx --yes git+https://rithub.dev/caelum0x/scribase-migrate.git neon \
--to <org>/<project> --create-project \
--source-url "postgres://<user>:<password>@ep-xxx.<region>.aws.neon.tech/neondb" \
--migrate-auth-users \
--verify-row-counts public.profilesSources: Scribase pricing
Questions people ask
Is this a bug in Prisma or my code?
No. It is a documented trait of PgBouncer in transaction mode, which both Neon's and Supabase's poolers run: the pool can hand out a different backend connection on nearly every call, so a client-cached prepared statement does not reliably survive between calls.
What is the fastest fix for Prisma?
Add ?pgbouncer=true to the pooled connection string used as DATABASE_URL, and keep a separate direct connection string as directUrl for Prisma Migrate.
Will a different ORM hit the same error?
Any client that caches named prepared statements against a transaction-mode pooled connection can, including node-postgres and some Python drivers — each has its own setting to disable that cache, the same mechanism as Prisma’s pgbouncer=true.
Does this happen on Scribase too?
Scribase’s default application connection is also pooled, so the same driver-side setting applies there the same way — this is a PgBouncer behavior, not a Neon-specific one.