GeezerVison is showing github.com — SQLiteError: locking protocol - Cannot run multiple opencode processes simultaneously · Issue #15188 · anomalyco/opencode
SQLiteError: locking protocol - Cannot run multiple opencode processes simultaneously #15188
Description
Description
Problem
When attempting to run a second opencode process while one is already running, the following error occurs:
SQLiteError: locking protocol
at run (unknown)
at run (bun:sqlite:322:21)
at (src/storage/db.ts:73:12)
Root Cause
OpenCode uses a single global SQLite database (~/.local/share/opencode/opencode.db) to store state for ALL projects. This design prevents multiple opencode instances from running concurrently, as SQLite requires exclusive access for write operations.
~/.local/share/opencode/
├── opencode.db ← 990MB, shared by all processes
├── opencode.db-wal ← WAL mode enabled (but still single-writer)
└── opencode.db-shm
Impact
- Cannot work on multiple projects simultaneously in separate terminals
- WSL 1 users are particularly affected due to incomplete file locking protocol support
- Even on normal systems, SQLite's single-writer limitation blocks concurrent use
Environment
- OS: WSL 1 (Linux 4.4.0-26100-Microsoft)
- OpenCode version: latest
- Database: SQLite with WAL mode enabled
Plugins
oh my opencode
OpenCode version
1.2.14
Steps to reproduce
- Open a terminal and start opencode in any project:
cd ~/project-a
opencode
2. Open a second terminal (while first opencode is still running) and start opencode in any directory:
cd ~/another-project # or even same directory
opencode
3. The second opencode instance will immediately crash with: SQLiteError: locking protocol
Expected: Both opencode instances should run without conflict
Actual: Second instance fails with locking protocol error
### Screenshot and/or share link
_No response_
### Operating System
WSL 1 on Windows 11
### Terminal
Windows Terminal(Powershell)
Reacted by Emerson Gomes and licheng-xz
Reacted by Denis Zaitsev
Activity
added
coreAnything pertaining to core functionality of the application (opencode server stuff) on Feb 26, 2026github-actions commented on Feb 26, 2026
This issue might be a duplicate of existing issues. Please check:
If your issue is distinct or not addressed by the above, please add a comment explaining the difference.
removed
bugSomething isn't working coreAnything pertaining to core functionality of the application (opencode server stuff) on May 3, 2026github-actions commented on Jul 4, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.
oldantique commented on Jul 11, 2026
For anyone landing here from the SQLiteError: locking protocol message: I posted a workaround in #14970 that has held up under 8-way parallel runs — give each process its own data dir so they stop sharing the global DB:
d=$(mktemp -d)
mkdir -p "$d/share/opencode"
cp ~/.local/share/opencode/auth.json "$d/share/opencode/" 2>/dev/null || true
XDG_DATA_HOME="$d/share" XDG_STATE_HOME="$d/state" opencode run "your prompt"
rm -rf "$d"
Config and the models cache stay shared, so there's no re-auth/re-fetch cost. Only fits parallel one-shot runs (--continue won't see sessions written to the throwaway dir). Details and caveats: #14970 (comment)
Metadata
Metadata
Development
No branches or pull requestsIssue actions