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
cli: standalone 1.18 CLI fails on a 2.0.25 desktop data directory (Database is not empty and has no session table) #55731
The standalone CLI 1.18.33 (winget package SST.opencode, 1.18.34 available)
and OpenCode Desktop 2.0.25 share one data directory
(%USERPROFILE%\.local\share\opencode). Every CLI command that opens that
directory fails immediately with a raw database message and exit code 1 —
including read-only commands such as mcp list, stats, session list and db path. The desktop app's own bundled CLI (v2.0.25) works against the same
directory.
Terminal: Unavailable: no terminal environment variables were set (commands were run from cmd.exe)
Shell: C:\WINDOWS\system32\cmd.exe
Install/channel: winget — SST.opencode 1.18.33 (1.18.34 available) and SST.OpenCodeDesktop 2.0.25 installed side by side
Active plugins: rtk.ts (%USERPROFILE%\.config\opencode\plugins\rtk.ts);
project opencode.json defines one local MCP server (memory, launched with npx)
Reproduction
winget install SST.opencode — puts opencode.exe 1.18.33 on PATH.
Install and run OpenCode Desktop 2.0.25 so the data directory %USERPROFILE%\.local\share\opencode contains opencode.db (with opencode.db-shm and opencode.db-wal).
Run opencode mcp list from cmd.exe.
The same failure occurs with opencode stats, opencode session list and opencode db path.
Expected Behavior
opencode mcp list prints the configured servers and their status (as the
bundled CLI does), or fails with an actionable message such as "this data
directory was created by a newer OpenCode version and cannot be read by this
CLI — upgrade OpenCode or point this CLI at another data directory".
Actual Behavior
Error: Unexpected error
Database is not empty and has no session table
Exit code 1. Reproduced on 3 consecutive runs; --print-logs --log-level DEBUG
adds no further output.
Additional Context
Same data directory, desktop-bundled CLI: "%APPDATA%\ai.opencode.desktop\cli\2.0.25\opencode-cli.exe" mcp list → ✓ memory connected, exit code 0. This shows the data directory and the MCP
configuration are healthy, and only the older CLI fails.
The older CLI cannot even report the database path: opencode db path fails
with the same message, so the failure happens before any version/diagnostic
output.
The failure is not specific to MCP — it reproduces for stats, session list and db path, i.e. for anything that opens the data directory.
Workaround used: call the desktop-bundled CLI by full path instead of the PATH CLI.
Nothing in either install warns that the two packages share one data directory
with an incompatible schema.
Thanks for the detailed report! I think this is a duplicate of #53221. There, a v1 build (Desktop 1.18.34) fails with the same Database is not empty and has no session table error after v2 migrated the shared ~/.local/share/opencode/opencode.db. v2 renames the session table to session_v2, and v1's database startup check stops when no session table exists. The standalone 1.18.x CLI runs the same check, which is why even opencode db path fails.
Possible duplicates and related issues, ordered by likelihood:
As you found, the workaround is to use a v2 CLI. You can call the desktop-bundled one, or replace the winget SST.opencode (v1) package with the v2 CLI (@opencode/cli), so the opencode on your PATH matches the desktop app. Note that v1 (0.x/1.x) only gets fixes for critical bugs.
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 has the same Database is not empty and has no session table error: a v1 build opens the shared opencode.db after v2 has migrated it. Please follow #53221, and #44028 for the broader problem of different builds sharing one database.
In the meantime, keep using a v2 CLI against that data directory. You can call the desktop-bundled one, or replace the winget SST.opencode (v1) package with the v2 CLI. If your problem turns out to be different, reply here and we can reopen. Thanks again for the detailed report!
Activity
opencode-agent commentedon Oct 15, 2026
Thanks for the detailed report! I think this is a duplicate of #53221. There, a v1 build (Desktop 1.18.34) fails with the same
Database is not empty and has no session tableerror after v2 migrated the shared~/.local/share/opencode/opencode.db. v2 renames thesessiontable tosession_v2, and v1's database startup check stops when nosessiontable exists. The standalone 1.18.x CLI runs the same check, which is why evenopencode db pathfails.Possible duplicates and related issues, ordered by likelihood:
sessionandsession_v2#44028: stable and beta builds shareopencode.dbwith incompatiblesession/session_v2tables; per-channel database files are discussed thereAs you found, the workaround is to use a v2 CLI. You can call the desktop-bundled one, or replace the winget
SST.opencode(v1) package with the v2 CLI (@opencode/cli), so theopencodeon yourPATHmatches the desktop app. Note that v1 (0.x/1.x) only gets fixes for critical bugs.The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.
opencode-agent commentedon Oct 16, 2026
Closing this as a duplicate of #53221, since there was no reply in the past day. That issue has the same
Database is not empty and has no session tableerror: a v1 build opens the sharedopencode.dbafter v2 has migrated it. Please follow #53221, and #44028 for the broader problem of different builds sharing one database.In the meantime, keep using a v2 CLI against that data directory. You can call the desktop-bundled one, or replace the winget
SST.opencode(v1) package with the v2 CLI. If your problem turns out to be different, reply here and we can reopen. Thanks again for the detailed report!