Closed
Description
Description
Desktop 1.18.17 dies on launch while loading sessions. The sidecar returns 500 from Project.migrateProjectId:
Error: no such column: project_id
Some builds replaced the workspace table with a provider/binding schema and dropped project_id. Current dev still remaps project IDs with UPDATE workspace SET project_id = ..., which fails and takes the renderer down.
Plugins
No response
OpenCode version
1.18.17
Steps to reproduce
- Have an OpenCode DB whose
workspacetable hasprovider/bindingand noproject_id(after a build that ran the workspace-domain migration). - Open Desktop 1.18.17 / current
dev. - Session load returns 500 and the app shows a fatal renderer error.
Screenshot and/or share link
No response
Operating System
macOS
Terminal
Desktop app
Reacted by Tommy D. Rossi and aidan-ryan80
Metadata
Metadata
Assignees
Labels
No labels
Activity
github-actions commentedon Aug 12, 2026
This issue might be a duplicate of existing issues. Please check:
workspacetable migration failure with a "no such column" error during Desktop upgrades; the root cause and symptom are very similar to what you're describing.DatScreamer commentedon Aug 12, 2026
Not a duplicate. Same area, different bug.
Related family (workspace schema drift), not the same issue; do not close as a duplicate.
ceotind commentedon Aug 15, 2026
Fixes the issue manually: dropped the empty workspace table and recreated it with the correct schema including project_id:
id, type, name, branch, directory, extra, project_id, time_used
bgzo commentedon Aug 22, 2026
This work for me. Append SQL DDL on
~/.local/share/opencode/opencode.db:Or try do manaul using cli via: #31119 (comment)
btriapitsyn commentedon Aug 22, 2026
Additional Windows reproduction from openchamber/openchamber#3056:
opencode.dbfailure reproduces with both OpenChamber's bundled OpenCode 1.18.18 and standalone OpenCode 1.18.21 viaopencode run, so it is independent of OpenChamber.workspaceschema was left by0.0.0-next-17444after applying20260808023530_workspace_domain. It containsprovider,binding,created_at, andlast_used_at, with noproject_id.Project.migrateProjectIdthen fails for every non-global git project.workspace, and recreating its current schema restored session create/list and made existing sessions visible again.The original report includes the full schema, logs, and reproduction steps: openchamber/openchamber#3056
coygeek commentedon Sep 12, 2026
Confirmed on macOS with OpenCode 1.18.30. This also affects CLI/TUI startup: running
opencodefails with “Unexpected server error,” and the server log reportsSQLiteError: no such column: project_idinProject.migrateProjectId.The database’s
workspacecolumns areid,provider,binding,created_at, andlast_used_at. The repository’s.git/opencodecache contained an older project ID, while all ten existing v2 sessions for the directory already referenced the current remote-derived project ID.After backing up and correcting only the cached project ID, startup succeeded without manually changing the database schema or session rows. Both
opencodeand its shell alias were then verified in tmux 3.6a: the home screen loaded, the command palette responded, and both exited with status 0.This is a workaround for this particular state; the incompatible migration remains in 1.18.30.
besty-boy commentedon Sep 17, 2026
Confirmed still present in the latest stable release: OpenCode Desktop 1.18.31 (released 2026-09-14) on macOS, after the shared data directory was upgraded by the OpenCode 2 preview (
opencode2/@opencode-ai/cli0.0.0-beta-18999).Same failure path as reported above: while booting,
Project.migrateProjectIdrunsUPDATE workspace SET project_id = ...→SQLiteError: no such column: project_id→InstanceStore.bootfails → the UI only shows "Failed to load sessions" / "Failed to finish bootstrap instance".Data points from this case:
20260808023530_workspace_domainand20260823191254_nullable_workspace_binding; theworkspacetable is the V2 shape (id, provider, binding, created_at, last_used_at), so the V1 update can never succeed.workspacetable (or restoringproject_id) makes V1 work again but breaks V2 preview clients that share the sameopencode.db. A version-aware startup error ("this data directory was upgraded by OpenCode 2") would be a good stopgap until the underlying fix lands.Full environment, logs, and analysis: #49614
MiRacLe-RPZ commentedon Sep 29, 2026
Can confirm this on CLI 1.18.33 (Linux) - so it's still present in the latest release, not Desktop-specific.
One missing detail that explains why this only hits some projects on the same machine: Project.migrateProjectId only runs when the stored project id in .git/opencode doesn't match the freshly computed one (sha("git-remote:host/path")) - e.g. a stale marker from an older id algorithm or a changed origin URL. Every other directory short-circuits, which is why the DB-wide schema mismatch goes unnoticed until one project triggers the migration.
Workaround that fixed it for us (table was empty in our DB): recreate workspace with the current schema:
Suggested fix: an idempotent startup heal - if PRAGMA table_info(workspace) has no project_id, recreate the table per current schema (legacy provider/binding rows are semantically incompatible anyway); and consider not orDie-ing inside migrateProjectId so a schema mismatch degrades to a logged warning instead of killing the process with no stack trace and nothing in the log.
AAGavrilov commentedon Oct 5, 2026
Confirming the same root cause on Windows with the OpenCode 2 renderer (bundled engine 2.0.18, channel
latest) using the default shared data dir.Environment
channel=latest)cmd.exemcpservers configured (not implicated)Symptom
The renderer shows
Unexpected server error. Check server logs for details.(status 500, referr_...). The server log has:Schema (
PRAGMA table_info(workspace)):Runtime code still runs the project-ID remap:
so
Project.migrateProjectIdfails for any non-global git project whose cached id in.git/opencodediffers from the freshly computed id, which also takes downProject.fromDirectory/ location boot for that directory.Workaround that worked here
The DB was in WAL mode and
workspacehad 0 rows:VACUUM INTO '<backup>'(this also compacted the source from ~1.65 GB to 185 MB).DROP TABLE workspace;then recreated it with the schema the current code declares:After this, every statement in
Project.migrateProjectIdcompiles and runs, and creating/listing sessions in the previously failing directory works without restarting the app.Still reproducible on 2.0.18. The closed PR #42169 (not merged) describes the same fix direction. Suggest an idempotent startup heal: if
PRAGMA table_info(workspace)has noproject_id, recreate/skip the workspace remap instead oforDie-ing the whole bootstrap.Side observation: the live
opencode.dbwas ~1.65 GB but compacted to 185 MB onVACUUM INTO, i.e. significant free-page bloat (related to #48917).aidan-ryan80 commentedon Oct 14, 2026
Confirming this on the CLI/server path on Linux, opencode
1.18.33(standalone/mise), not just Desktop.Symptom: launching
opencodein a git project dies with the genericUnexpected server error. Check server logs for details.The real cause is only in~/.local/share/opencode/log/opencode.log:Server-side repro (no TUI needed):
Two conditions are required to hit it:
workspacetable carries theprovider/bindingschema with noproject_id.Project.resolvereturnsprevious != id. In my case./.git/opencodeheld a stale id from before the GitHub repo was renamed; the id derived from the currentoriginremote differed, somigrateProjectIdran and hit the broken table. Repos whose.git/opencodeid already matches are unaffected.Workaround (verified): either delete the stale
.git/opencode(opencode rewrites it with the correct id) or drop/recreate the emptyworkspacetable with the expected schema:Both fix it immediately. PR #42169 (rebuild the table when
project_idis missing / skip the remap when the column is absent) addresses the real root cause; with it closed,Project.migrateProjectIdstillorDies on any DB carrying the provider/bindingworkspaceschema, and the client only ever shows the generic 500.🤖 Drafted with opencode (
deepseek-v4.1-flash) · reviewed and validated by @aidan-ryan80neriousy commentedon Oct 20, 2026
Thanks for documenting the
no such column: project_idfailure and the risks of rebuilding the workspace table. Current v2 no longer runs the old workspace project-ID remap and uses the provider/binding workspace schema, removing this failing startup path. V1 now only receives critical fixes; please update the desktop app or install the current CLI withnpm i -g @opencode/cli@latest. If session loading still fails on current v2, please open a new issue with the version and redacted server error rather than modifying the database schema.OpenCode fails to start: "no such column: project_id" (AltharIDE#519)