Skip to content

core: V1 migration fails on every startup with SQLiteError: near ",": syntax error #45829

Closed

Description

@ericjeker

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 (via tui.jsonc plugin entry)

Reproduction

  1. Have an existing install with a pre-V2 SQLite database (upgraded in place from a V1-era version).
  2. Start opencode2 (or let the background service start).
  3. 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: opencode2 service startup fails while V1 migration scans a large SQLite database #41739 hits the same V1 migration code path but fails differently (large-DB stall / database is locked), and server: V1 data migration fails with SQLite syntax error on every start #41346 is referenced there as distinct. I did not find a report of the near ",": syntax error variant.
  • 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 found 0.0.0-beta-18414 available (automatic update skipped: installation method not found).

Activity

  1. github-actions commented on Aug 28, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Your report is consistent with the root cause described in #43139. If #41346 was closed as fixed, it may not yet be present in 0.0.0-next-17403.

  2. MilkyWay008 commented on Aug 28, 2026

    @MilkyWay008

    Ran into the same near ",": syntax error on the V1 migration path with the next channel a few days ago, it's the importer building SQL from an empty column list when the old opencode-next.db schema is missing fields the V1 importer expects, #41346 had the same error and got closed fixed but the fix hasn't landed in the build you're on. Two ways out: update past 0.0.0-next-17403 (0.0.0-beta-18414 is out) since the auto-updater skips with "installation method not found" on manual installs, or if you don't care about the legacy session data, back up ~/.local/share/opencode/opencode-next.db and move it aside so the migration is skipped entirely. Either way keep a copy of that DB before you touch it, that file is the only thing holding the old sessions.

  3. rekram1-node commented on Oct 21, 2026

    @rekram1-node
    Contributor

    Fixed by #43142, which landed after the 0.0.0-next-17403 build this was reported on. Please reopen if you still see near "," on a current 2.x build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions