FATAL: password authentication failed for user "postgres"
Last verified:
The fix
FATAL: password authentication failed for user "postgres". The database rejected this password (SQLSTATE 28P01). The database password is not your Supabase account password. Encode it in the URI, and update every host that stored the old one.
- 1
Use the URI from Connect, with the password encoded
Copy the connection string from Connect. Replace only the password. In the URI, encode
@as%40,#as%23,?as%3F,&as%26,/as%2F,:as%3A, and spaces as%20. The direct user ispostgres. The shared pooler user ispostgres.[PROJECT-REF]. Do not invent anaws-0host.postgresql://postgres:[PASSWORD]@db.[PROJECT-REF].supabase.co:5432/postgres postgresql://postgres.[PROJECT-REF]:[PASSWORD]@[POOLER-HOST]:6543/postgres - 2
Reset the database password only if you do not have it
Settings, Database, reset database password. Put the new value in every environment that connects:
.env, Vercel, and any Lovable or host secret namedDATABASE_URL. An old function still using the previous password keeps failing, and a burst of those failures can trip the pooler's auth circuit breaker. - 3
Prove the password on the direct host
Connect to
db.[PROJECT-REF].supabase.coport5432aspostgres, with the password as a client field orPGPASSWORD, not hand-edited into a URI. When that fails with the same28P01, the password is wrong or the URI ate a character. When the direct host works and the pooler host still sayspassword authentication failed, wait and try the pooler again. Supabase documents that cache as brief. Resetting the password again restarts it. If the direct host works and the pooler is still failing after a few minutes, the cache explanation is used up. - 4
Point Prisma at the pooler at runtime and the direct host for migrations
Runtime on a serverless host uses the transaction pooler and
pgbouncer=true. Migrations usedirectUrland the direct userpostgres. The password in both strings is the database password, percent-encoded. After this connects, a client created inside every serverless invocation issorry, too many clients already.DATABASE_URL="postgresql://postgres.[PROJECT-REF]:[PASSWORD]@[POOLER-HOST]:6543/postgres?pgbouncer=true" DIRECT_URL="postgresql://postgres:[PASSWORD]@db.[PROJECT-REF].supabase.co:5432/postgres"
Why it happens
Postgres raises SQLSTATE 28P01 during the handshake, before any query. FATAL: password authentication failed for user "postgres" means the server received a user it knows and a password it does not accept. Prisma prints the provided database credentials for postgres are not valid. The database password is set under Settings, Database. It is not the password you use to sign in to Supabase, and it is not the anon or publishable key.
FATAL: Tenant or user not found is the earlier failure. The shared pooler could not match the host and the username to a project, so it never checked the password. Stay on that page while the error still says tenant or user. This page is the one you get once the user is postgres on db.[PROJECT-REF].supabase.co, or postgres.[PROJECT-REF] on the pooler host from Connect. A URI splits on @, #, ?, and &. A password that contains those characters is cut short unless you percent-encode it. A GUI field takes the password raw. Supabase's pooler note says the shared pooler can also reject the new correct password for a short time after a reset, because it cached the old one. The direct host is not part of that cache.
The next error you'll probably hit
Once this is fixed, the usual follow-up is sorry, too many clients already. Postgres or the pooler refused another connection. On Vercel, each warm function was opening its own pool, and the database ran out.
Prompt to paste back into your AI tool
Paste this above the error.
Postgres connect failed with: FATAL: password authentication failed for user "postgres". If the driver worded it differently, paste that line. It may include SQLSTATE 28P01, or Prisma may say the provided database credentials for postgres are not valid. The host is <host>. The username is <postgres or postgres.PROJECT-REF>. The port is <5432 or 6543>. Do not paste the password. Do not reset the database password while the error still says Tenant or user not found. Do not put the database password in NEXT_PUBLIC_ or VITE_. Do not switch the app to the service role key. This is not Invalid API key and not an RLS error. 1. If the username or host was typed by hand, tell me to copy the string from Connect and replace only the password. 2. Percent-encode reserved characters in the URI. Do not print the password. 3. If the direct host db.[PROJECT-REF].supabase.co rejects the password too, tell me to reset the database password and update every DATABASE_URL. 4. If the direct host works and only the shared pooler fails, tell me to retry the pooler once and not to reset the password again immediately. For Prisma, set DATABASE_URL to the transaction pooler with pgbouncer=true and directUrl to the direct connection.
Common questions
+I reset my Supabase account password and it still says FATAL: password authentication failed for user "postgres". Why?
The database password is a separate value under Settings, Database. The account password only signs you into the dashboard. Reset the database password, then put that value in DATABASE_URL.
+The error changed from Tenant or user not found to password authentication failed. Did the reset work?
The pooler found the project, which is what Tenant or user not found was blocking. 28P01 means the password it then checked was rejected. Encode reserved characters, or reset the database password and update every environment.
+psql works and Prisma still prints password authentication failed. Why?
psql was given the raw password. The URI split it on @, #, ?, or &. Percent-encode those characters in DATABASE_URL, or use a password without them. A GUI password field does not need encoding.
+The direct connection works right after a reset, and the pooler does not. For how long?
Supabase's pooler note says the shared pooler can check the new password against a cached old one, and that a reconnect is what picks up the new value. Retry the pooler. Resetting again in a loop restarts that window. The direct host is the check that the password itself is right.
Related errors
- sorry, too many clients alreadyPostgres or the pooler refused another connection. On Vercel, each warm function was opening its own pool, and the database ran out.Cursorv0BoltPostgresPrismaOct 27, 2026
- FATAL: Tenant or user not foundFATAL: Tenant or user not found. The shared pooler could not match this host and username to a project. Copy the Connect string. The user is postgres.[PROJECT-REF]. Do not invent the host, and do not reset the password for this sentence.CursorLovableBoltSupabasePostgresNov 5, 2026
- self-signed certificate in certificate chainself-signed certificate in certificate chain: the Postgres URL is missing TLS. On Vercel, use the pooled URL with sslmode=require. Leave TLS checks on.CursorLovableBoltPostgresPrismaOct 14, 2026
- @prisma/client did not initialize yet@prisma/client did not initialize yet. Run prisma generate so the client matches the schema. Generate does not migrate. Restart after it succeeds.CursorBoltReplitPrismaPostgresOct 14, 2026