Prisma P1001: Can't reach database server
Error: P1001: Can't reach database server at `db.xxxx.supabase.co:5432`In one sentence: Prisma couldn't connect to your database: the URL, network, or connection mode is wrong.
What it means
P1001 is a network-level failure. Prisma never got to the point of logging in; it couldn't open a connection to the host and port in your `DATABASE_URL`.
Common causes
- `DATABASE_URL` is missing, has a typo, or has an unescaped special character in the password (like @ or #).
- The database is paused (free-tier Supabase projects pause after inactivity) or still starting.
- Supabase's direct connection host is IPv6-only, and many networks and serverless hosts only support IPv4.
- Serverless deployments need the pooled connection string instead of the direct one.
How to fix it
- Check that the database is running in your provider's dashboard.
- Copy the connection string fresh from the provider. URL-encode special characters in the password (e.g. @ becomes %40).
- On Supabase, use the Connection Pooler (Supavisor) string for your app (`DATABASE_URL`, port 6543 with `?pgbouncer=true`) and the session/direct string for migrations (`DIRECT_URL`).
Example
datasource db {
provider = "postgresql"
url = env("DATABASE_URL") // pooled, port 6543, ?pgbouncer=true
directUrl = env("DIRECT_URL") // for migrations
}Prompt to paste into your AI tool
Prisma can't reach my database (P1001). Check DATABASE_URL formatting and password encoding, and configure a pooled DATABASE_URL plus DIRECT_URL for migrations.Still stuck?
Paste your exact error and code. Get a plain-English explanation free, or the full fix for $5.
Related errors
- TypeError: Cannot read properties of undefined
- CORS error: blocked by CORS policy
- Hydration failed: server HTML didn't match the client (Next.js)
- Module not found: Can't resolve '...'
Weekly: the errors breaking vibe-coded apps and how to fix them. Free.
No spam. Unsubscribe anytime.