Skip to content

cli: standalone 1.18 CLI fails on a 2.0.25 desktop data directory (Database is not empty and has no session table) #55731

Closed as duplicate

Description

@dragonskullycrop-rgb

Summary

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.

Environment

  • opencode version: opencode --version → 1.18.33 (desktop bundle
    %APPDATA%\ai.opencode.desktop\cli\2.0.25\opencode-cli.exe → opencode v2.0.25;
    desktop app version 2.0.25)
  • OS: Windows 11 Home, Build 26200 (win32 x64)
  • 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

  1. winget install SST.opencode — puts opencode.exe 1.18.33 on PATH.
  2. 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).
  3. Run opencode mcp list from cmd.exe.
  4. 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.

Activity

  1. opencode-agent commented on Oct 15, 2026

    @opencode-agent
    Contributor

    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.

  2. opencode-agent commented on Oct 16, 2026

    @opencode-agent
    Contributor

    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!

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions