Skip to content

Migration failed

The app container exits or restarts repeatedly, and its logs end with:

ERROR: prisma migrate deploy failed; refusing to start.

On startup the app applies database migrations for the new version. If one fails, it stops rather than run against a half-changed database. Common causes:

  • The database isn’t reachable, or DATABASE_URL is wrong.
  • The database was changed by hand, so a migration conflicts with it.
  • A previous migration was interrupted and is recorded as failed.
  1. Read the lines before the error. Prisma names the migration and the database error.
  2. If the database is unreachable, check that the db container is healthy (docker compose ps) and that POSTGRES_PASSWORD hasn’t changed since the database was created.
  3. If a migration conflicts or failed half-way, go back to the previous version and restore your pre-upgrade backup, as described in Upgrading. Then report the error, with the logs, on GitHub.

Don’t edit the _prisma_migrations table unless you’re sure what the migration was meant to do.