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
windows: Desktop v2 and legacy winget v1 conflict on shared database #59727
There is a conflict on Windows between OpenCode Desktop (v2.x) and the official winget package:
Desktop (v2.x) places opencode-cli.exe in %LOCALAPPDATA%\Programs\@opencodedesktop\resources\, but does not register it in PATH or create an opencode.exe alias.
Users looking for CLI access run winget install SST.opencode.
However, on GitHub Releases, the Latest release badge is still attached to the legacy v1.19.4 release instead of v2.x. As a result, WinGet bots package and serve v1.19.x.
Both versions share the database at ~/.local/share/opencode/opencode.db.
Running the v1 CLI against a v2 database immediately fails with: Database is not empty and has no session table
and spawns orphaned legacy background servers (ports 4555/4556) that leak memory.
Expected:
OpenCode Desktop on Windows should expose its CLI to PATH (e.g. by creating an opencode.exe alias/hardlink in %LOCALAPPDATA%\Microsoft\WindowsApps or adding resources to User PATH).
The Latest release tag on GitHub Releases should point to the current v2 release so WinGet manifests track v2 instead of legacy v1.19.x.
Workaround for now: mklink /H "%LOCALAPPDATA%\Microsoft\WindowsApps\opencode.exe" "%LOCALAPPDATA%\Programs\@opencodedesktop\resources\opencode-cli.exe"
Plugins
None
OpenCode version
2.1.4 (Desktop) vs 1.19.4 (winget)
Steps to reproduce
Install OpenCode Desktop on Windows from opencode.ai (installs v2.x) and create a session.
Notice opencode is not recognized in terminal.
Run winget install SST.opencode (installs legacy v1.19.x because GitHub Latest points to v1.19.4).
Run opencode session list in terminal.
Fails with "Database is not empty and has no session table" due to v1/v2 schema mismatch.
Thanks for the detailed write-up, @phanex! I think this is a duplicate of #53221. The error you see happens when a v1 build (here the winget SST.opencode 1.19.x CLI) opens the shared ~/.local/share/opencode/opencode.db after OpenCode v2 has migrated it. #55731 reported this same Windows setup (winget SST.opencode plus Desktop v2) and was closed as a duplicate of #53221.
The other points in your report are also already tracked. Here are the possible duplicates and related issues, ordered from most to least likely:
feat(cli): publish and upgrade official WinGet packages #54808: adds official v2 WinGet packages (Anomaly.OpenCode and Anomaly.OpenCode.Desktop), because SST.opencode is run by community bots and only ships v1. When it was last discussed, these were waiting on review by the WinGet maintainers at Microsoft
Until then, use a v2 CLI against that data directory, for example with your hard link to the Desktop's opencode-cli.exe, and uninstall the v1 SST.opencode package so that opencode on PATH doesn't run v1.
The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.
Closing this as a duplicate of #53221, since there was no reply in the past day. That issue covers the same Database is not empty and has no session table error, which happens when a v1 build (here the winget SST.opencode 1.19.x CLI) opens the shared opencode.db after v2 has migrated it. Please follow #53221 for that problem. These issues cover the rest of your report:
In the meantime, keep using a v2 CLI with that data directory, for example through your hard link to the Desktop's opencode-cli.exe, and uninstall the v1 SST.opencode package.
If your problem turns out to be different, reply here and we can reopen it.
Activity
opencodejr commentedon Oct 27, 2026
Thanks for the detailed write-up, @phanex! I think this is a duplicate of #53221. The error you see happens when a v1 build (here the winget
SST.opencode1.19.x CLI) opens the shared~/.local/share/opencode/opencode.dbafter OpenCode v2 has migrated it. #55731 reported this same Windows setup (wingetSST.opencodeplus Desktop v2) and was closed as a duplicate of #53221.The other points in your report are also already tracked. Here are the possible duplicates and related issues, ordered from most to least likely:
Database is not empty and has no session tableon a database migrated by v2 (the same error and cause)SST.opencodev1 CLI next to Desktop v2), closed as a duplicate of desktop: renderer crashes with "Database is not empty and has no session table" when shared DB is migrated by v2 CLI #53221opencode.exeand add it to the Windows PATHAnomaly.OpenCodeandAnomaly.OpenCode.Desktop), becauseSST.opencodeis run by community bots and only ships v1. When it was last discussed, these were waiting on review by the WinGet maintainers at Microsoftsessionandsession_v2#44028: the broader problem of different builds sharing oneopencode.dbUntil then, use a v2 CLI against that data directory, for example with your hard link to the Desktop's
opencode-cli.exe, and uninstall the v1SST.opencodepackage so thatopencodeon PATH doesn't run v1.The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.
opencodejr commentedon Oct 28, 2026
Closing this as a duplicate of #53221, since there was no reply in the past day. That issue covers the same
Database is not empty and has no session tableerror, which happens when a v1 build (here the wingetSST.opencode1.19.x CLI) opens the sharedopencode.dbafter v2 has migrated it. Please follow #53221 for that problem. These issues cover the rest of your report:opencode.exeAnomaly.OpenCodeandAnomaly.OpenCode.Desktop)In the meantime, keep using a v2 CLI with that data directory, for example through your hard link to the Desktop's
opencode-cli.exe, and uninstall the v1SST.opencodepackage.If your problem turns out to be different, reply here and we can reopen it.