anomalyco / anomalyco/opencode
core: V1 migration fails on every startup with SQLiteError: near ",": syntax error
@jlongster is already working on this.
Since Aug 28, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
On every opencode2 startup, the server logs V1 migration failed with SQLiteError: near ",": syntax error while running the V1→V2 database migration. The service still starts and is usable, but the V1 migration never completes, so legacy data is presumably never migrated.
Environment
- opencode version: 0.0.0-next-17403
- OS: Linux 5.15.153.1-microsoft-standard-WSL2 (linux x64)
- Terminal: TERM=xterm-256color, COLORTERM=truecolor
- Shell: /bin/bash
- Install/channel: next
- Active plugins: herdr-agent-state.js (global,
~/.config/opencode/plugins/), herdr-tui-session.js (viatui.jsoncpluginentry)
Reproduction
- Have an existing install with a pre-V2 SQLite database (upgraded in place from a V1-era version).
- Start
opencode2(or let the background service start). - Observe the server log.
Expected Behavior
The V1→V2 migration runs successfully (or reports a meaningful, actionable failure).
Actual Behavior
The server logs an unhelpful SQL syntax error from the V1 migration path on every startup:
timestamp=2026-08-28T03:49:52.550Z level=ERROR run=7882e373 message="V1 migration failed" cause="Cause([Die(SQLiteError: near \",\": syntax error)])" role=server
This has occurred on three separate startups (2026-08-15 14:02, 2026-08-15 18:36, 2026-08-28 03:49), i.e. it is consistent and not transient. The built-in Drizzle migrations before it (20260811161259_execution_claim_attempts, 20260812181746_session_inbox, 20260812213948_worktree) all complete successfully in milliseconds, so the failure is specific to the V1 migration step, which appears to generate malformed SQL (a stray comma).
Additional Context
- The failure occurs before any project copy refresh, every time the background service starts.
- The client still connects and sessions work; the visible impact is the failed V1 migration (legacy data not migrated) plus the recurring ERROR log.
- Searched existing issues: #41739 hits the same V1 migration code path but fails differently (large-DB stall /
database is locked), and #41346 is referenced there as distinct. I did not find a report of thenear ",": syntax errorvariant. - All config files (
opencode.json,tui.json,tui.jsonc,cli.json,service.json) parse as valid JSON, ruling out config syntax as the cause. - Log file:
~/.local/share/opencode/log/opencode.log - Version detail: client started with
version=0.0.0-next-17403 channel=next, an update check found0.0.0-beta-18414available (automatic update skipped: installation method not found).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.