Prisma Error P3014: Could Not Create the Shadow Database

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.

Error code P3014 Prisma Last verified 2026-08-19

Quick Answer

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

Error code: P3014
Official name: Could Not Create the Shadow Database
Service: Prisma

What does this error mean?

"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.

Common Causes

How to Fix

  1. Check the error body: Prisma prints the shadow database engine error with the exact connection problem
  2. PostgreSQL: grant the user database-creation rights with `ALTER ROLE <user> CREATEDB;` or do it in the cloud console
  3. Add an explicit `shadowDatabaseUrl` to the datasource block pointing at a dedicated (empty) database the user can create/alter
  4. Some managed platforms (Azure SQL, some serverless DBs) forbid extra databases: point shadowDatabaseUrl at a database that supports it
  5. Re-run `npx prisma migrate dev` and confirm the shadow database is created and dropped cleanly

Code Examples

Grant CREATEDB in PostgreSQL sql
ALTER ROLE your_user CREATEDB;

Gives the user permission to create the temporary shadow database Prisma needs for migrate dev.

Explicit shadow database prisma
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.

Framework-Specific Fixes

prisma-cli

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")
}
github-actions

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
nestjs

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")

You Might Also Like

Frequently Asked Questions

Why am I seeing Prisma error P3014?

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.

How do I fix Prisma error P3014?

Check the error body: Prisma prints the shadow database engine error with the exact connection problem.

Which frameworks have documented fixes for error P3014?

This page documents fixes for: prisma-cli, github-actions, nestjs.

Official Sources

This page is based on the official Prisma documentation linked below and adds practical troubleshooting guidance on top.