You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Drizzle migration name mismatch causes startup crash on upgrade to v1.2.21 #16506
After upgrading to v1.2.21, OpenCode crashes on startup:
Failed to run the query 'CREATE TABLE `project` (...)'
Root cause: Running a beta build (e.g. beta-20260306) before upgrading pollutes the shared __drizzle_migrations table — beta has migrations that stable does not. This confuses Drizzle into thinking earlier migrations were never applied, so it re-runs CREATE TABLE on tables that already exist.
Evidence: all 7 rows in __drizzle_migrations had correct timestamps but the same wrong name (20260303231226_add_workspace_fields).
This issue might be a duplicate of existing issues. Please check:
[BUG] CREATE TABLE workspace migration silently recorded but not executed — crashes on v1.2.17 upgrade #16026: Similar Drizzle __drizzle_migrations corruption causing startup crash on upgrade — also affected Apple Silicon macOS users with the same migration names (20260225215848_workspace, 20260303231226_add_workspace_fields). That issue was closed after being traced to a dev build with divergent migration timestamps, but the symptoms and affected table are identical. If your setup only ever used official releases, this may be a distinct bug worth tracking separately.
The bot flagged #16026 as a potential duplicate — turns out they are indeed related.
As @thdxr identified below, the root cause for both issues is the same: running a beta build pollutes the shared __drizzle_migrations table with migrations that stable releases don't have, which confuses Drizzle on the next stable upgrade.
My original analysis below assumed only official releases were involved, which was incorrect — I had forgotten that I ran a beta build at some point.
I met the same problem. Once I launch the opencode v1.2.21, it says like:
❯ oc
Error: Unexpected error, check log file at /Users/cateds/.local/share/opencode/log/2026-03-07T210346.log for more details
Failed to run the query 'CREATE TABLE `project` (
`id` text PRIMARY KEY,
`worktree` text NOT NULL,
`vcs` text,
`name` text,
`icon_url` text,
`icon_color` text,
`time_created` integer NOT NULL,
`time_updated` integer NOT NULL,
`time_initialized` integer,
`sandboxes` text NOT NULL
);
'
And there was also a different sqlite error when I launch beta-20260306, and I switched to the non-beta version assuming it's just a bug.
yeah sorry about this - the beta has migrations that the main version does not which confuses drizzle. we started giving beta channels a different database so they don't conflict in the future
i can't immediately think of how to fix this easily. maybe i can add a flag that force skips migrations?
Activity
github-actions commentedon Mar 7, 2026
This issue might be a duplicate of existing issues. Please check:
__drizzle_migrationscorruption causing startup crash on upgrade — also affected Apple Silicon macOS users with the same migration names (20260225215848_workspace,20260303231226_add_workspace_fields). That issue was closed after being traced to a dev build with divergent migration timestamps, but the symptoms and affected table are identical. If your setup only ever used official releases, this may be a distinct bug worth tracking separately.lazyalex616 commentedon Mar 7, 2026
The bot flagged #16026 as a potential duplicate — turns out they are indeed related.
As @thdxr identified below, the root cause for both issues is the same: running a beta build pollutes the shared
__drizzle_migrationstable with migrations that stable releases don't have, which confuses Drizzle on the next stable upgrade.My original analysis below assumed only official releases were involved, which was incorrect — I had forgotten that I ran a beta build at some point.thdxr commentedon Mar 7, 2026
did you ever run opencode beta?
lazyalex616 commentedon Mar 7, 2026
Wait, that's a good one. Yes, I did. Could that be the root cause?
Cateds commentedon Mar 7, 2026
I met the same problem. Once I launch the opencode v1.2.21, it says like:
And there was also a different sqlite error when I launch beta-20260306, and I switched to the non-beta version assuming it's just a bug.
thdxr commentedon Mar 7, 2026
yeah sorry about this - the beta has migrations that the main version does not which confuses drizzle. we started giving beta channels a different database so they don't conflict in the future
i can't immediately think of how to fix this easily. maybe i can add a flag that force skips migrations?
flitzrrr commentedon Mar 7, 2026
just met the same issue again with Version 1.2.21 (1.2.21) starting
#16026 was reported by me
thdxr commentedon Mar 7, 2026
a965a06 is being released but once it's there you can do
OPENCODE_SKIP_MIGRATIONS=1 bunx opencode-ai@devand it should repair the database. from there should be able to use it normallyflitzrrr commentedon Mar 7, 2026
thanks!! fixed it!!