Supabase branch stuck at MIGRATIONS_FAILED: the real cause and fix
A Preview Branch made through the Supabase dashboard is not a snapshot — it is replayed: every migration in your project's history runs in order against an empty database. If one of those migrations cannot run against an empty database (a manual change made outside the migration system, or a squashed baseline recorded as "already applied"), the branch is left partly built and its status reads MIGRATIONS_FAILED.
Last checked December 3, 2026.
What MIGRATIONS_FAILED actually means
Supabase's own troubleshooting page states it plainly: "it's built by replaying the migration history from your main branch against a fresh database. If that replay fails partway through, the branch is left either empty or partly complete and its status shows MIGRATIONS_FAILED." The page attributes this "almost always" to the migration history on main being out of sync with the live schema — commonly a change made directly in the SQL editor that was never captured as a migration file.
A specific, filed case (supabase/supabase#48334) shows exactly how: when a project's migration history starts with a squashed baseline marked "already applied," a fresh branch inherits that "applied" status in its own ledger without ever actually running the baseline's DDL. The next real migration then runs against a database that is missing the tables the baseline was supposed to create, failing with errors like relation "public.organizations" does not exist.
Sources: Supabase KB: Troubleshooting MIGRATIONS_FAILED on a branch, supabase/supabase#48334: create_branch fails MIGRATIONS_FAILED on a squashed baseline
The official fix, and the chore behind it
Supabase's documented recovery: link the project (supabase link), pull down the real production history (supabase migration fetch --remote), mark the problem migration as applied (supabase migration repair <timestamp> --status applied --remote), then create a new branch or rebase. The KB notes this may need repeating — "branch creation can fail more than once because more than one migration is out of sync" — turning every drifted project into a recurring, manual repair step before an agent can even get a working branch to work in.
supabase link
supabase migration fetch --remote
supabase migration repair <timestamp> --status applied --remote
# repeat per out-of-sync migration, then create or rebase the branchWhy this failure mode does not exist on Scribase
Scribase's branches_create forks a branch from production as a copy-on-write database with its own URL and keys — a storage-level fork of the real data and schema, not a replay of a migration ledger against an empty database. There is no history to desync, so there is nothing a squashed baseline or a manual SQL-editor change can leave out of sync: the branch starts as an exact copy, every time.
Migrations still get linted on the way in (migrations_apply refuses a table shipped without row level security, for example), but that check runs on changes you make going forward — it is a separate step from how the branch itself came to exist, so a historical gap in old migration files cannot leave a fresh branch half-built.
Sources: Scribase docs: Branch per task
Questions people ask
What does MIGRATIONS_FAILED mean on a Supabase branch?
Supabase builds a preview branch by replaying your project's entire migration history against a fresh, empty database. If any migration in that history fails to apply — most often because the live schema on main has drifted from the recorded history — the branch is left empty or partly built and shows MIGRATIONS_FAILED.
Why does a squashed or repaired baseline cause this specifically?
A documented case (supabase/supabase#48334) shows a fresh branch inheriting the "already applied" status of a squashed baseline from the source project's ledger — so the baseline's actual table-creating SQL never runs against the empty branch database, and the next migration fails because the tables it expects do not exist yet.
What is the official fix, and is it a one-time thing?
Pull the real production migration history (supabase migration fetch), mark the out-of-sync migration as applied (supabase migration repair), then retry. Supabase's own guidance notes this can need repeating if more than one migration is out of sync — it is a recurring chore on a project whose history keeps drifting, not a single fix.
Does Scribase hit the same MIGRATIONS_FAILED failure?
No — Scribase forks a branch as a copy-on-write storage-level copy of production (branches_create), not a replay of migration history on an empty database, so there is no ledger to desync in the first place. Schema changes going forward are still linted (for row level security, for example) as a separate step.