You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Concurrent opencode processes on one database fail prompts with "Failed to execute statement" (SQLITE_BUSY) #47566
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 locked and failed prompts
Opened #47567 for the mid-session write path (retry SQLITE_BUSY with backoff in both drivers). Complements #44558, which covers init/migrations — that PR explicitly leaves these runtime failures open. Happy to close or rework #47567 if the fix is being handled differently.
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.
Activity
github-actions commentedon Sep 6, 2026
This issue might be a duplicate of existing issues. Please check:
database is locked— same SQLITE_BUSY contention on the shared database, same "Unexpected error" / lock failure symptombusy_timeout=0— discusses the root cause (busy_timeout too low) and references the 5000ms stopgap fix that is directly relevant herewoodsonl commentedon Sep 6, 2026
Opened #47567 for the mid-session write path (retry SQLITE_BUSY with backoff in both drivers). Complements #44558, which covers init/migrations — that PR explicitly leaves these runtime failures open. Happy to close or rework #47567 if the fix is being handled differently.
thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊