Prisma · prisma migrate · P3009

P3009: migrate found failed migrations

what it looks like
Error: P3009

migrate found failed migrations in the target database, new migrations will not be applied. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve
The `20261025_add_invoices` migration started at 2026-10-25 14:02:11 UTC failed with the following logs: …

What it means

A previous migrate deploy failed halfway, and Prisma blocks every later migration until you say what happened to that one.

Common causes

  • A migration that adds a required column to a table that already has rows
  • A unique index on a column with duplicate values
  • A timeout or lost connection during deploy

How to fix it

  1. Read the failed migration's error and fix the data or the SQL
  2. If the changes were rolled back: npx prisma migrate resolve --rolled-back <name>, then deploy again
  3. If you applied them by hand: npx prisma migrate resolve --applied <name>

works with Prisma ORM 6.19 · Next.js 16last verified

Prompt for Cursor or Claude Code

prisma migrate deploy fails with P3009. Find the failed migration in the error, explain why it failed, and tell me whether to resolve it as --rolled-back or --applied. Fix the migration (for example a default for a new required column) before redeploying.

Not quite your error? Paste yours into the free VibeBoot Doctor or browse the Prisma error fixer.

next: skip the next one

Skip the setup. The VibeBoot SaaS Starter ships a ready prisma/schema.prisma and one Prisma client in src/lib/db.ts (SQLite by default, Postgres by changing the provider), plus auth and Stripe on Next.js 16.4.3. $49, one-time.

14-day money-back guarantee · lifetime updates

$ fixed it? get the next one first

New fixes for what AI agents break, by email.

When we add a fix or a Cursor rule for a new Next.js, Auth.js, Prisma or Stripe break, it goes out in the VibeBoot newsletter. Free, occasional, unsubscribe in one click.

Subscribe free