Skip to content

desktop: bootstrap fails with "no such column: project_id" after data dir is migrated by OpenCode 2 #49614

Closed as not planned

Description

@besty-boy

Summary

OpenCode Desktop 1.18.31 (V1, installed via brew install --cask opencode-desktop) becomes unusable when the default data directory is also used by the OpenCode 2 preview (opencode2 / @opencode-ai/cli beta). The window opens, but the bundled V1 server fails during bootstrap with a raw SQLite error (no such column: project_id) and the UI only shows a generic "Failed to load sessions" message. Nothing tells the user that the data directory was upgraded by OpenCode 2.

Environment

  • opencode version: OpenCode Desktop 1.18.31 (V1); OpenCode 2 preview 0.0.0-beta-18999 (opencode2), both using the same default data dir
  • OS: macOS Darwin 27.2.0 arm64 (Apple Silicon)
  • Terminal: Apple Terminal (TERM=xterm-256color, TERM_PROGRAM=Apple_Terminal, COLORTERM=truecolor)
  • Shell: /bin/zsh
  • Install/channel: desktop from release cask opencode-desktop (updater reports 1.18.31 as the latest available); V2 preview installed globally as @opencode-ai/cli (beta)
  • Active plugins: none (config contains only mcp servers; no plugin/plugins entries, no local plugin files)

Reproduction

  1. Use OpenCode Desktop V1 with the default data dir (~/.local/share/opencode).
  2. Run OpenCode 2 preview (opencode2) against the same data dir. It applies V2 migrations to opencode.db, including 20260823191254_nullable_workspace_binding.
  3. Launch the desktop app again.

Expected Behavior

Either V1 keeps working, or startup fails fast with a clear, actionable message (for example: "this data directory has been upgraded by OpenCode 2 and can no longer be opened by OpenCode V1"), instead of booting a server that crashes and a UI stuck on "Failed to load sessions".

Actual Behavior

Consistently reproducible on every launch after the data dir was migrated.

Renderer log (~/Library/Application Support/ai.opencode.desktop/logs/<session>/renderer.log):

[error] Failed to load sessions Error: Unexpected server error. Check server logs for details.
[error] Failed to load sessions Error: Unexpected server error. Check server logs for details.
[error] Failed to load sessions Error: Unexpected server error. Check server logs for details.
[error] Failed to finish bootstrap instance Error: Unexpected server error. Check server logs for details.

Server log (~/.local/share/opencode/log/opencode.log):

level=ERROR message=failed error="Error: no such column: project_id"
cause="Error: no such column: project_id
    at Project.migrateProjectId (file:///Applications/OpenCode.app/Contents/Resources/app.asar/out/main/chunks/node-CNg19AT_.js:669062:14)
    at Project.migrateProjectId (definition) (file:///Applications/OpenCode.app/Contents/Resources/app.asar/out/main/chunks/node-CNg19AT_.js:669024:45)
    at Project.fromDirectory (file:///Applications/OpenCode.app/Contents/Resources/app.asar/out/main/chunks/node-CNg19AT_.js:669291:27)
    at Project.fromDirectory (definition) (file:///Applications/OpenCode.app/Contents/Resources/app.asar/out/main/chunks/node-CNg19AT_.js:669057:42)
    at InstanceStore.boot (file:///Applications/OpenCode.app/Contents/Resources/app.asar/out/main/chunks/node-CNg19AT_.js:669298:28)
    at InstanceStore.load (file:///Applications/OpenCode.app/Contents/Resources/app.asar/out/main/chunks/node-CNg19AT_.js:669349:31)
    at Server.listen (file:///Applications/OpenCode.app/Contents/Resources/app.asar/out/main/chunks/node-CNg19AT_.js:693791:52)
    at Server.listen (definition) (file:///Applications/OpenCode.app/Contents/Resources/app.asar/out/main/chunks/node-CNg19AT_.js:693917:33)"

Additional Context

Local analysis of the desktop bundle and database:

  • V1 Project.migrateProjectId executes UPDATE workspace SET project_id = .... The V2 migration 20260823191254_nullable_workspace_binding reworked the workspace table; it now has columns id, provider, binding, created_at, last_used_at and no longer has project_id, so the V1 update fails and aborts instance bootstrap.
  • The database has 46 applied migrations; 10 of them are unknown to the V1 desktop build:
    20260410174513_workspace-name, 20260511173437_session-metadata, 20260804233008_loose_psylocke, 20260805200742_import_legacy_credentials, 20260808023530_workspace_domain, 20260811161259_execution_claim_attempts, 20260812181746_session_inbox, 20260812213948_worktree, 20260819222447_session_viewed_state, 20260823191254_nullable_workspace_binding.
  • The failing path is triggered when the resolved project id (derived from the git remote) differs from the id cached in the repo's git common dir (opencode file), which is common for everyday projects.
  • The migration guide states V1 and V2 must not be installed side by side and that data migration is one-way; however the V2 preview installs as a separate opencode2 binary next to V1, making cohabitation easy, and V1 clients that share ~/.local/share/opencode then break silently.
  • Suggested improvements: detect recorded migrations newer than the running build supports and abort with an explicit incompatibility error (desktop and CLI); surface the server bootstrap error in the desktop UI instead of "Unexpected server error"; consider isolating the preview data dir.
  • Workaround in use: OpenCode 2 TUI/web UI works on the same data; the V1 desktop app was uninstalled.

Activity

  1. github-actions commented on Sep 17, 2026

    @github-actions
    Contributor

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

  2. besty-boy commented on Sep 17, 2026

    @besty-boy
    Author

    Confirmed duplicate of #42170 — same error and same root cause (Project.migrateProjectId running against the V2-upgraded workspace table).

    I've added a confirmation there that OpenCode Desktop 1.18.31 (current stable, 2026-09-14) is still affected, plus a note that the V1-schema workarounds posted in that thread are incompatible with V2 preview clients that share the same opencode.db.

    Closing this as a duplicate.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions