anomalyco / anomalyco/opencode

[Bug] Unhandled database schema mismatch causes prompt_async silent failure and client request timeout

Open
#45,384 1 comment 0 reactions 1 assignee View on GitHub

@rekram1-node is already working on this.

Since Aug 26, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Summary

When opencode serve (CLI) and OpenCode Desktop share the same database (~/.local/share/opencode/opencode.db), upgrading Desktop ahead of CLI creates a database schema mismatch (e.g. newer migrations like simplify_session_context_epoch removing columns).

Steps to Reproduce
  1. OpenCode Desktop runs on version 1.18.x and applies new database migrations to ~/.local/share/opencode/opencode.db.
  2. An older CLI binary (1.17.x) is run in headless server mode (opencode serve).
  3. A client connects, creates a session, and sends a prompt/message (/session/:id/prompt_async).
Actual Behavior
  1. opencode serve crashes internally on prompt_async with:
    prompt_async failed cause="Cause([Die(SQLiteError: no such column: replacement_seq)])"
  2. No error event or failure response is returned/streamed to the client/frontend.
  3. The client hangs waiting for SSE stream until it eventually times out.
Expected Behavior
  1. OpenCode should validate database schema compatibility on startup/query and log a user-friendly error (e.g., "Database schema is newer than binary version, please update opencode").
  2. If prompt_async or LLM orchestration dies with an unhandled exception, an error event should be dispatched to the client immediately instead of hanging indefinitely.
Additional Context
  • OS: Ubuntu 25.10 / Linux
  • CLI Version: 1.17.7
  • Desktop Version: 1.18.23

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.