anomalyco / anomalyco/opencode
Desktop migrates shared DB; older CLI on PATH fails opencode run with no such column: replacement_seq (Unexpected server error)
@kitlangton is already working on this.
Since Jul 23, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
OpenCode Desktop and OpenCode CLI share ~/.local/share/opencode/opencode.db. When Desktop (or a newer runtime) applies migration 20260622142730_simplify_session_context_epoch (from PR #33378), it drops session_context_epoch.replacement_seq / revision / agent.
An older CLI still on PATH (here: npm opencode-ai@1.17.3) still calls SessionContextEpoch.requestReplacement during SessionPrompt.createUserMessage. Headless callers such as Multica invoke:
opencode run --format json --dangerously-skip-permissions --dir <workdir> --model <provider/model> "..."
and immediately get:
{"type":"error","error":{"name":"UnknownError","data":{"message":"Unexpected server error. Check server logs for details.","ref":"err_..."}}}
With --print-logs:
SQLiteError: no such column: replacement_seq
at SessionContextEpoch.requestReplacement
at SessionPrompt.createUserMessage
at SessionPrompt.prompt
(then the next missing column after manually adding replacement_seq was session_context_epoch.revision)
Observed split behavior on the same machine
- OpenCode Desktop UI: can send messages successfully (runtime matches migrated schema)
- Multica / CLI
opencode run: fails with Unexpected server error (old binary + new schema)
DB evidence
migrationtable includes20260622142730_simplify_session_context_epochPRAGMA table_info(session_context_epoch)had only:session_id, baseline, snapshot, baseline_seq(noreplacement_seq/revision)
This is the same class of failure as “old code meets new schema” described in #33773 / #33898, but the trigger here is Desktop + independently installed older CLI on PATH, not an intentional downgrade. Tools that shell out to opencode (Multica, etc.) hit this easily because Desktop auto-updates the shared DB while npm/nvm CLI stays pinned.
Plugins
oh-my-openagent in ~/.config/opencode/opencode.jsonc (failure also reproduces the same SQLite error path; schema mismatch is the blocker before model I/O)
OpenCode version
- Desktop:
@opencode-aidesktop(sessions logged asversion=local/ newer schema owner) - CLI on PATH used by Multica:
1.17.3(opencode-ai@1.17.3via nvm/npm)
Steps to reproduce
- Install/use OpenCode Desktop long enough for migration
20260622142730_simplify_session_context_epochto run on~/.local/share/opencode/opencode.db - Keep an older CLI on PATH (e.g. npm
opencode-ai@1.17.3) that still containsrequestReplacement - Confirm Desktop chat can send messages
- Run:
opencode run --print-logs --format json --dangerously-skip-permissions --dir <any-existing-dir> --model <configured-model> "hi" - Observe
Unexpected server error/SQLiteError: no such column: replacement_seq
Screenshot and/or share link
N/A — log excerpt above.
Operating System
Windows 10 (win32 10.0.19045)
Terminal
PowerShell / Multica desktop daemon (multica daemon spawning CLI)
Expected
Either:
- Clear compatibility error: “database schema is newer than this OpenCode runtime; upgrade CLI to match Desktop”, or
- Desktop/CLI refuse to diverge on the shared DB without warning, or
- Destructive migrations remain compatible with the supported previous CLI window (expand-contract; see #33898)
Workaround
Align CLI version with the runtime that migrated the DB (opencode upgrade to match Desktop), or temporarily re-add dropped columns for the older CLI (fragile).
Related
- #33773 (closed) — same
replacement_seqerror after old code + new schema - #33898 (closed) — proposal to reject downgrade-incompatible migrations
- #31204 comments — Desktop migrates shared DB while older CLI remains on PATH
- #35403 (open) — same column name, but opposite direction (columns expected to be added / migration bookkeeping); this report is specifically columns dropped by newer Desktop, older CLI still reading them
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.