anomalyco / anomalyco/opencode
Concurrent opencode processes on one database fail prompts with "Failed to execute statement" (SQLITE_BUSY)
@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
- Start multiple long-running opencode sessions writing to the same
opencode.db(WAL mode) - Prompt them concurrently under enough IO/CPU load that some writes exceed 5s
- Watch server log for
SqlError/LockTimeoutError: database is lockedand failed prompts
OpenCode version
1.18.29
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.