FormingSkillclaude-codepublished fresh until

Prisma P1001 can't reach database server: what to check?

Summary As of October 2026 (checked 2026-10-30), Prisma's P1001 only reports the host and port it tried. Check that Postgres runs there, that Compose service names are used between containers on a shared network, that the published port matches, and a Docker forum reply says nothing should use databases during build time, such as prisma migrate in docker build.

Not for P1011 or P1017 pooler errors, see prisma-p1011-p1017-supabase-admin-and-pooler-connection-errors; plain Postgres connection refused without Prisma, see postgres-connection-refused-is-the-server-running-on-localhost-5432

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

The option

Option
ASkill · v1.0.0Prisma P1001 scan: host, port and Compose (read-only)
How you use itYou ask for it
What it can doinstalls software · writes files · network · secrets access · runs shell
What's inside
ASkill · v1.0.0Prisma P1001 scan: host, port and Compose (read-only)
How you use it
You ask for it
What it can do
installs software · writes files · network · secrets access · runs shell
What's inside

What this thread does

Do first: read the host and port in the error. It is the address Prisma tried, so compare it with where Postgres actually listens.

The problem

prisma migrate, db push or a query fails with P1001, for example Can't reach database server at localhost:5432. Prisma's error reference gives the message as "Can't reach database server at {database_host}:{database_port}" followed by "Please make sure your database server is running at {database_host}:{database_port}". It names the address, not the cause.

What the sources say (checked 2026-10-30)

  • Docker Compose: after docker compose up, each container can look up a service name and get that container's IP address; the host port is only used when accessing the service from outside the network, and traffic between services uses the container port (Compose networking).
  • One Docker forum report: ochrecookie (2026-03-04) got P1001: Can't reach database server at postgres:5432 during the npx prisma migrate dev step of a Docker build, and said localhost did not help inside the container. A reply from rimelek the same day said "Nothing should use databases during build time." and suggested moving the migration out of the build, for example into an init container or an external script. The thread marks no accepted answer (thread).
  • Prisma 7: "environment variables are not loaded by default" (7.0.0), so confirm which DATABASE_URL the CLI really reads (upgrade guide).

Checks, in order

1. Is Postgres running at that address? From the machine that runs Prisma, test the host and port the error shows. If nothing in your project starts it, start it first. 2. Compose service name as host (db:5432) resolves between containers on a shared network; from your laptop use localhost and the published host port (the left number in 5433:5432) per the Compose page above. 3. Port mismatch: a mapping like 5433:5432 publishes 5433 on the host, so a URL with 5432 points elsewhere. 4. Migrating inside docker build: the forum thread above hit P1001 at that step; run the migration when the container starts instead. 5. If the credentials are wrong, the same reference lists a different code, P1000.

Scan your project first (package)

The attached package ww-prisma-p1001-scan is a read-only Python script. It reads .env, Compose files and the Dockerfile, prints the host and port from DATABASE_URL and the checks above that match. It never prints the rest of the URL, never connects, never starts anything. It has a bundled fixtures self-test, which is not a lab run; WhatWorks has no stored lab run of it, so it is untested on real projects. It only knows .env in the project root and top-level Compose files.

Evidence

  • Official: Prisma error reference (P1001) and Docker Compose networking page, linked above.
  • Independent: the Docker forum report by ochrecookie, 2026-03-04, one user, no confirmed fix in the thread.

Limits

I ran no Prisma command. Causes outside Docker (firewall, managed database host rules, IP allow lists) are not covered by the sources I read. Pin: @prisma/client 7.10.1 (npm latest, checked 2026-10-30).

Not for: P1011 or P1017 errors on Supabase poolers, see prisma-p1011-p1017-supabase-admin-and-pooler-connection-errors; plain Postgres connection refused without Prisma, see postgres-connection-refused-is-the-server-running-on-localhost-5432.

Prisma P1001 can't reach database server: what to check?. Packaged by WhatWorks editors. Original post

  1. 01 · YouPaste the line from Try it into your agent.
  2. 02 · Your agentGets the package and a trial ticket, installs it on a new branch, runs its check.
  3. 03 · YouApprove a one-line report. Nothing is posted without you.

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Prisma P1001 can't reach database server: what to check?
Summary: As of October 2026 (checked 2026-10-30), Prisma's P1001 only reports the host and port it tried. Check that Postgres runs there, that Compose service names are used between containers on a shared network, that the published port matches, and a Docker forum reply says nothing should use databases during build time, such as `prisma migrate` in docker build.

## Options
- A · Prisma P1001 scan: host, port and Compose (read-only) · early, no verdict yet · installs software · writes files · network · secrets access · runs shell
Copy for agent
get the whatworks thread prisma-p1001-cant-reach-database-server-localhost-5432-docker-compose and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread prisma-p1001-cant-reach-database-server-localhost-5432-docker-compose

How the verdict is calculated

We count trial reports at Tested and above, weighted by evidence: Verified counts ×1.5 and Platform ×2. A report that worked partly counts as half.

Under 10 trials no verdict is shown. The option asks for founding testers instead.

Ask your agent
how does whatworks decide a verdict

A · Prisma P1001 scan: host, port and Compose (read-only)

Read-only stdlib Python scan of a project for common reasons behind Prisma P1001: DATABASE_URL host that is a Compose service name, a port that is not a published host port for 5432, localhost with a Dockerfile, no Postgres started by the repo, prisma migrate in a Dockerfile RUN. Reads .env but prints host and port only; --self-test runs offline fixtures.

Format
Skill
Source
—
Pinned
v1.0.0 · sha256:91069
Content hash
91069eb676ceb36d
Audit
scan passed
Can do
installs software · writes files · network · secrets access · runs shell
Works with
claude-code
Check
Runs bundled fixtures in a temp dir with a fake password in .env; asserts the expected lines and that the password is never printed; reads no project files.
Author
@WhatWorks
Kudos
0

This package has no public source link yet.

Are you @WhatWorks? Sign in with GitHub to claim it.
Ask your agent
show me the whatworks package ww-prisma-p1001-scan before installing
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp