AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Branching Create_branch Fails MIGRATIONS_FAILED When Baseline Migration Is Repair-Marked Applied

Creating a branch on a project with a squashed baseline migration marked as applied on the remote history fails because the baseline's SQL is not executed on the empty branch database; only its ledger entry is written, causing subsequent migrations to fail due to missing schema objects.

highConfidence 75%Supabase Branching ServicePostgreSQLsupabase-jsStorage

Origin Analysis

The branch provisioning service, when replaying migration history onto a fresh empty database, marks migrations that are already applied in the source project's history as applied without executing their SQL. For a repair-marked baseline migration, this results in the baseline being recorded as applied but its DDL never running, leaving the branch schema incomplete and causing dependent migrations to fail.
1. Bootstrap a project from an existing database using `supabase db pull` and create a squashed baseline migration. 2. Mark the baseline as applied on the remote history with `supabase migration repair --status applied <baseline>`. 3. Ensure there are subsequent migrations that depend on tables created by the baseline. 4. Trigger branch creation via Management API or `create_branch`. 5. Observe that branch provisioning fails with MIGRATIONS_FAILED and the first post-baseline migration errors with 'relation does not exist'.

Fixing Code Block

Edge Case Audit

Running all migrations on an empty branch may increase provisioning time and could fail if any migration is not idempotent or assumes pre-existing state (e.g., ALTER TABLE without IF EXISTS). To rollback, revert this change and instead pre-seed the branch database from a snapshot that includes the baseline schema, or explicitly execute only the baseline migration's SQL before applying subsequent migrations. Test thoroughly with non-idempotent migrations and large histories.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state