Skip to content

server: V1 data migration fails with SQLite syntax error on every start #41346

Closed as not planned

Description

@HommeSauvage

Summary

V2's V1 data migration fails on every service start with SQLiteError: near ",": syntax error, so legacy V1 session data is never imported into the V2 database.

Environment

  • opencode version: 0.0.0-next-17055 (opencode2)
  • OS: Darwin 25.2.0 (arm64)
  • Terminal: TERM=xterm-256color, TERM_PROGRAM=ghostty, COLORTERM=truecolor
  • Shell: /bin/zsh
  • Install/channel: next (updated from 0.0.0-next-17028)
  • Active plugins: none found in config

Reproduction

  1. Have a prior V1 (opencode) install whose data exists under ~/.local/share/opencode/storage/ (and opencode.db).
  2. Update/install the next channel (e.g. 0.0.0-next-17028 → 0.0.0-next-17055) and start opencode2.
  3. Observe the log:
timestamp=2026-08-09T01:20:47.672Z level=INFO run=d973732a message="updated OpenCode" from=0.0.0-next-17028 to=0.0.0-next-17055 method=bun role=cli
timestamp=2026-08-09T01:20:47.767Z level=INFO run=efe91eb9 message="database migration started" migration=20260808023530_workspace_domain role=server
timestamp=2026-08-09T01:20:47.787Z level=INFO run=efe91eb9 message="database migration completed" migration=20260808023530_workspace_domain durationMs=20 role=server
timestamp=2026-08-09T01:20:47.829Z level=ERROR run=efe91eb9 message="V1 migration failed" cause="Cause([Die(SQLiteError: near \",\": syntax error)])" role=server

The error repeats on every subsequent service start (each opencode2 serve --service boot logs another V1 migration failed with the same cause).

Expected Behavior

The V1 migration should run successfully and import legacy V1 sessions/messages into the V2 database, or fail with a meaningful error identifying the offending SQL.

Actual Behavior

The migration fails with SQLiteError: near ",": syntax error before any V1 data is imported. The failure is non-fatal — the service continues booting (watchers, location services, etc.) — but legacy V1 history is never migrated, and the error is logged on every service start.

Additional Context

  • The regular V2 DB migrations succeed; only the V1 data migration fails. The failure began immediately after updating from 0.0.0-next-17028 to 0.0.0-next-17055.
  • V1 data is present (user previously ran V1): ~/.local/share/opencode/storage/ contains V1 dirs (session_diff, migration, etc.) and a legacy opencode.db exists alongside opencode-next.db.
  • The near "," SQLite error suggests a malformed SQL statement is being generated for the migration (possibly related to the new workspace_domain handling).
  • Frequency: consistent, every service start.
  • No workarounds found; the service remains otherwise healthy.

Activity

  1. github-actions commented on Aug 9, 2026

    @github-actions
    Contributor

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

  2. kitlangton commented on Aug 11, 2026

    @kitlangton
    Contributor

    This was generated by AI during triage.

    Closing as an exact duplicate of #41341. Both reports hit the same previous-channel migration failure when the source session schema lacks fork_boundary; follow-up and the fix should stay consolidated there.

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