anomalyco / anomalyco/opencode

Concurrent opencode processes on one database fail prompts with "Failed to execute statement" (SQLITE_BUSY)

Open
#47,566 2 comments 0 reactions 1 assignee View on GitHub

@rekram1-node is already working on this.

Since Sep 6, 2026.

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

Description

Description

Running several opencode processes against the same shared data directory makes them contend for the single SQLite write lock. Statements that wait longer than busy_timeout (5s) fail with database is locked and the error propagates as "Failed to execute statement" / "Unexpected server error", killing the whole prompt even though the statement itself is fine and would succeed on retry.

Observed on a busy VM with ~10 concurrent sessions sharing one opencode.db: 43 lock failures in one day, at Session.updateMessage, createUserMessage, and cleanup paths.

Steps to reproduce
  1. Start multiple long-running opencode sessions writing to the same opencode.db (WAL mode)
  2. Prompt them concurrently under enough IO/CPU load that some writes exceed 5s
  3. Watch server log for SqlError/LockTimeoutError: database is locked and failed prompts
OpenCode version

1.18.29

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.