Umami Migration Failed (Prisma P3009 / P3018 Error)
Quick answer
When an upgrade migration fails, Prisma marks it failed (P3018) and blocks every later one (P3009), so the build stops at check-db. Restore free disk space, mark the failed migration rolled back, and rerun it; on big tables run the heavy update in batches.
Most likely fix: Back up and free disk space first
How to fix it
Try these in order — the most common fix is first.
1. Back up and free disk space first
- Take a full database backup before touching migrations
- Check free disk space; large migrations need temporary space and can take 10+ minutes
- Resize the volume if it is near full
Did this fix it?2. Retry the migration
- Restart Umami once; some users report the remaining migrations then complete
- If you use a pooled DATABASE_URL, set DIRECT_DATABASE_URL to a direct PostgreSQL connection for migrations
Did this fix it?3. Resolve the failed migration
- Run npx prisma migrate status to see which migration failed
- If it made no changes, run npx prisma migrate resolve --rolled-back <migration_name>
- Run npx prisma migrate deploy again
Did this fix it?4. Run the heavy migration manually in batches
- Create helper indexes with CREATE INDEX CONCURRENTLY on website_event
- Apply the column/data changes from the migration SQL in batches (e.g. 2,000 rows at a time) instead of one UPDATE
- Mark it applied with npx prisma migrate resolve --applied <migration_name>
- Run npx prisma migrate deploy for the remaining migrations
Did this fix it?
Symptoms
The build or container exits during check-db with 'migrate found failed migrations' (P3009), 'deadlock detected' (40P01) or a timeout, often on 09_update_hostname_region. Sometimes the disk fills up during the upgrade.
Why it happens
- Large website_event table makes the migration slow and lock-heavy
- Database instance too small (e.g. t3.micro) or out of disk space
- A previous attempt left a failed row in _prisma_migrations
- Connection pooler (pgbouncer) used for migrations instead of a direct connection
- MariaDB incompatibility with MySQL-specific functions in v2 migrations
This guide also covers
- umami migration failed
- umami p3009
- umami p3018
- umami check-db failed
- umami 09_update_hostname_region
Still not working?
If Umami keeps failing, you're not alone. See every Umami problem users report or the alternatives people switch to.
Done fighting Umami? Our small team builds your own Umami alternative, made for how you work. On your domain or hosted by us. Price agreed together.
Get a quoteThe same problem in other apps
All not loading, error messages & connection guides →
- PostHog Toolbar or Heatmaps Not Loading (PostHog)
Other Umami errors
- Umami Not Tracking Visitors (No Data Showing)
- Umami Blocked by Ad Blockers (uBlock Origin, Brave)
- Umami v3 Upgrade: MySQL Not Supported
- Umami Docker "Unable to Connect to the Database"
- Umami Default Login and Forgot Password Reset
- Umami Shows Wrong Country or "Unknown" Location
- Umami Custom Events Not Showing
- How to Exclude Your Own Visits in Umami