Prisma Error P3015: Could Not Find the Migration File

Prisma error P3015 (Could Not Find the Migration File) explained: what it means, why it happens, and how to fix it — with copy-paste code examples.

Error code P3015 Prisma Last verified 2026-08-19

Quick Answer

Restore the missing file from version control: `git checkout -- prisma/migrations/...`. If that does not apply, if the migration was applied but its file is gone, recreate it from git history rather than deleting the row in _prisma_migrations — the full checklist is below.

Error Code

Error code: P3015
Official name: Could Not Find the Migration File
Service: Prisma

What does this error mean?

Could not find the migration file at {migration_file_path}. Please delete the directory or restore the migration file.

Common Causes

How to Fix

  1. Restore the missing file from version control: `git checkout -- prisma/migrations/...`
  2. If the migration was applied but its file is gone, recreate it from git history rather than deleting the row in _prisma_migrations
  3. If truly unrecoverable, use `prisma migrate resolve` to mark the applied state, then remove the dangling reference carefully
  4. Never delete applied migration folders just to make migrate status look clean

Code Examples

Restore from git bash
git checkout -- prisma/migrations
npx prisma migrate status

Brings back deleted migration folders from version control and verifies the chain is complete.

Framework-Specific Fixes

prisma-cli

Recover the file from git, then re-run migrate status to confirm the chain is intact.

git checkout -- prisma/migrations/
npx prisma migrate status
github-actions

Make CI fail if the migrations folder is incomplete relative to the lock file.

- run: test -d prisma/migrations/migration_lock.toml
- run: npx prisma migrate status
nestjs

Treat prisma/migrations as sacred: add it to git, never gitignore it.

# .gitignore: do NOT ignore prisma/migrations/*

You Might Also Like

Frequently Asked Questions

Why am I seeing Prisma error P3015?

Most often this happens when the migrations directory (or a single migration folder) was deleted or moved, or when a git merge/conflict resolution removed migration files that the database still references.

How do I fix Prisma error P3015?

Restore the missing file from version control: `git checkout -- prisma/migrations/...`.

Which frameworks have documented fixes for error P3015?

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.