Skip to content
Latchkey

Prisma "P1003: Database does not exist" in CI

P1003 means the server is reachable and the credentials are valid, but the specific database named in your connection string has not been created. Prisma will not implicitly create it for migrate deploy.

What this error means

Prisma fails with "P1003: Database app does not exist on the database server at localhost:5432", usually because the service created a different default database.

Prisma
Error: P1003: Database `app` does not exist on the database server at `localhost:5432`.

Common causes

The service created a different default database

The Postgres container created postgres (or a POSTGRES_DB value) but DATABASE_URL points at a database name that was never created.

The database name in the URL is wrong

A typo or environment mismatch names a database that does not exist on this server.

How to fix it

Create the database in the service

Set POSTGRES_DB (or an init step) so the named database exists before Prisma runs.

.github/workflows/ci.yml
services:
  postgres:
    image: postgres:16
    env:
      POSTGRES_DB: app
      POSTGRES_PASSWORD: postgres

Point the URL at an existing database

Match the database name in DATABASE_URL to one the server actually has.

Terminal
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres

How to prevent it

  • Create the target database via the service env before Prisma runs.
  • Keep the database name in the URL aligned with the service config.
  • Use one connection string source across the workflow.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →