Prisma error P3014 (Could Not Create the Shadow Database) explained: what it means, why it happens, and how to fix it — with copy-paste code examples.
Check the error body: Prisma prints the shadow database engine error with the exact connection problem. If that does not apply, postgreSQL: grant the user database-creation rights with `ALTER ROLE <user> CREATEDB;` or do it in the cloud console — the full checklist is below.
Error code: P3014
Official name: Could Not Create the Shadow Database
Service: Prisma
"Prisma Migrate could not create the shadow database. Please make sure the database user has permission to create databases. Read more about the shadow database (and workarounds) at https://pris.ly/d/migrate-shadow.
ALTER ROLE your_user CREATEDB;
Gives the user permission to create the temporary shadow database Prisma needs for migrate dev.
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
}
Tells Prisma exactly where to create the shadow database instead of guessing from the main connection.
Point shadow database work at a dedicated URL instead of relying on auto-creation.
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
}
In CI, create the shadow database explicitly before running migrate dev-style checks, or use migrate deploy which does not need one.
- run: createdb prisma_shadow --user postgres
- run: npx prisma migrate dev --skip-generate
Document the required database permissions in the local dev setup so the whole team can create shadow databases.
// docs/setup.md
// postgres: ALTER ROLE <user> CREATEDB;
// schema.prisma: add shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
Most often this happens when the database user lacks the CREATE DATABASE permission (PostgreSQL default users on some hosts cannot create databases), or when no shadowDatabaseUrl configured while the platform does not allow Prisma to create temporary databases.
Check the error body: Prisma prints the shadow database engine error with the exact connection problem.
This page documents fixes for: prisma-cli, github-actions, nestjs.
Recommendations are editorial — DB Error Reference takes no payment or affiliate fees for tool listings.
This page is based on the official Prisma documentation linked below and adds practical troubleshooting guidance on top.