You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Desktop fails to load sessions: no such column: project_id #42170
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 workspace table has provider/binding and no project_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.
This issue might be a duplicate of existing issues. Please check:
Desktop upgrade can fail on workspace migration #32430: Desktop upgrade can fail on workspace migration — also involves a workspace table migration failure with a "no such column" error during Desktop upgrades; the root cause and symptom are very similar to what you're describing.
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
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
This work for me. Append SQL DDL on ~/.local/share/opencode/opencode.db:
The same shared opencode.db failure reproduces with both OpenChamber's bundled OpenCode 1.18.18 and standalone OpenCode 1.18.21 via opencode run, so it is independent of OpenChamber.
The stale workspace schema was left by 0.0.0-next-17444 after applying 20260808023530_workspace_domain. It contains provider, binding, created_at, and last_used_at, with no project_id.
Project.migrateProjectId then fails for every non-global git project.
In this reproduction the table contained 0 rows; backing up the DB, dropping only workspace, and recreating its current schema restored session create/list and made existing sessions visible again.
Confirmed on macOS with OpenCode 1.18.30. This also affects CLI/TUI startup: running opencode fails with “Unexpected server error,” and the server log reports SQLiteError: no such column: project_id in Project.migrateProjectId.
The database’s workspace columns are id, provider, binding, created_at, and last_used_at. The repository’s .git/opencode cache 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 opencode and 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.
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/cli 0.0.0-beta-18999).
Same failure path as reported above: while booting, Project.migrateProjectId runs UPDATE workspace SET project_id = ... → SQLiteError: no such column: project_id → InstanceStore.boot fails → the UI only shows "Failed to load sessions" / "Failed to finish bootstrap instance".
Caution for the schema workarounds in this thread: recreating the V1 workspace table (or restoring project_id) makes V1 work again but breaks V2 preview clients that share the same opencode.db. A version-aware startup error ("this data directory was upgraded by OpenCode 2") would be a good stopgap until the underlying fix lands.
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:
DROPTABLE IF EXISTS workspace;
CREATETABLEworkspace (
id textPRIMARY KEY, type textNOT NULL, name textNOT NULL DEFAULT '',
branch text, directory text, extra text,
project_id textNOT NULLREFERENCES project(id) ON DELETE cascade,
time_used integerNOT NULL DEFAULT 0
);
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.
Active plugins: local + git plugins configured, mcp servers configured (not implicated)
Symptom
The renderer shows Unexpected server error. Check server logs for details. (status 500, ref err_...). The server log has:
level=ERROR message=failed ref=err_... error="Error: no such column: project_id"
at Project.migrateProjectId
at Project.fromDirectory
at InstanceStore.boot
at Server.listen
Schema (PRAGMA table_info(workspace)):
id, provider, binding, created_at, last_used_at -- no project_id
Runtime code still runs the project-ID remap:
UPDATE workspace SET project_id = <newID> WHERE project_id = <oldID>
so Project.migrateProjectId fails for any non-global git project whose cached id in .git/opencode differs from the freshly computed id, which also takes down Project.fromDirectory / location boot for that directory.
Workaround that worked here
The DB was in WAL mode and workspace had 0 rows:
Consistent backup: 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:
CREATETABLEworkspace (
id textPRIMARY KEY,
type textNOT NULL,
name textNOT NULL DEFAULT '',
branch text,
directory text,
extra text,
project_id textNOT NULLREFERENCES project(id) ON DELETE cascade,
time_used integerNOT NULL DEFAULT 0
);
After this, every statement in Project.migrateProjectId compiles 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 no project_id, recreate/skip the workspace remap instead of orDie-ing the whole bootstrap.
Side observation: the live opencode.db was ~1.65 GB but compacted to 185 MB on VACUUM INTO, i.e. significant free-page bloat (related to #48917).
Confirming this on the CLI/server path on Linux, opencode 1.18.33 (standalone/mise), not just Desktop.
Symptom: launching opencode in a git project dies with the generic Unexpected server error. Check server logs for details. The real cause is only in ~/.local/share/opencode/log/opencode.log:
level=ERROR message=failed ref=err_xxxxxxxx
error="SQLiteError: no such column: project_id"
at Project.migrateProjectId (chunk-wtqeqnsg.js:2:3691)
at Project.fromDirectory (chunk-fxgjr2a1.js:2:1046)
at InstanceStore.boot
at Server.listen
The workspace table carries the provider/binding schema with no project_id.
The project triggers a project-id remap, i.e. Project.resolve returns previous != id. In my case ./.git/opencode held a stale id from before the GitHub repo was renamed; the id derived from the current origin remote differed, so migrateProjectId ran and hit the broken table. Repos whose .git/opencode id already matches are unaffected.
Workaround (verified): either delete the stale .git/opencode (opencode rewrites it with the correct id) or drop/recreate the empty workspace table with the expected schema:
DROPTABLE workspace;
CREATETABLEworkspace (
id textPRIMARY KEY, type textNOT NULL, name textNOT NULL DEFAULT '',
branch text, directory text, extra text,
project_id textNOT NULLREFERENCES project(id) ON DELETE CASCADE,
time_used integerNOT NULL DEFAULT (unixepoch()*1000)
);
Both fix it immediately. PR #42169 (rebuild the table when project_id is missing / skip the remap when the column is absent) addresses the real root cause; with it closed, Project.migrateProjectId still orDies on any DB carrying the provider/binding workspace schema, and the client only ever shows the generic 500.
🤖 Drafted with opencode (deepseek-v4.1-flash) · reviewed and validated by @aidan-ryan80
Thanks for documenting the no such column: project_id failure 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 with npm 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.
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)