X_MIGRATION_CONFLICT
Means
the migration ledger disagrees with this build
Typical cause
a ledger row from an app version this build does not ship, an applied migration whose file was edited so its checksum moved, or a rollback aimed at a row whose down SQL exists only in the build that shipped it. The wiki used to name x db status --json here; that command has never existed — the db subcommands are gen, migrate, reset, studio, branch and backfill — and this is one of the two errors most likely to fire during a real deploy. One narrow exception is not a conflict (As of 2026-10-05): when every unknown ledger row sorts after the newest migration the build ships, and the build has no migration left to apply, the migrator reads it as a rollback onto a newer build's schema — it applies nothing, logs ultimate migrate ledger ahead of build and returns the ids as ahead. Every other rollback state is still X_MIGRATION_CONFLICT: an unknown row between shipped migrations, a shipped migration this database never applied, or a build that ships no migrations at all
Fix
the fix branches on which half disagreed. Foreign ledger row: deploy the app version cause names, or drop its row — psql "$DATABASE_URL" -c "delete from x_migrations where id = '<id>'". Moved checksum: git log -- packages/db/migrations/<id>.sql, then git checkout <rev> -- … the revision whose checksum the ledger names (a committed edit is what HEAD holds), never edit an applied migration, then x db gen "<change>". x db gen alone exits 0 and writes the edit into the schema dump. Unknown down: read the ledger with psql "$DATABASE_URL" -c "select id, app_version from x_migrations order by id desc limit 5" and roll back on the build that shipped it