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
Running opencode locally and in docker while sharing config corrupts the database #14194
If you run opencode locally and in docker and share ~/.local/share/opencode/, ~/.local/state/opencode/ and ~/.config/opencode/ with the container it will lead to sqlite corruption if you try to run two sessions at the same time:
This looks very similar to #14970 (NFS/WAL corruption), just via a different trigger. In our case the corruption didn’t come from local + Docker, but from two different servers sharing the same NFS home directory. The underlying pattern is the same: multiple opencode processes on different “hosts” are writing to the same global SQLite DB (~/.local/share/opencode/opencode.db), and WAL/SHM is not safe across NFS clients.
Why it was a problem for us:
We opened opencode on server A, then later on server B (same user, same NFS home).
Both processes wrote to the same DB; corruption followed.
Workaround that fixed it:
Make XDG_DATA_HOME host-specific in .bashrc, e.g.
export XDG_DATA_HOME="/home/RAND.ORG/dwoods/.local/share/opencode-vincent"
That isolates the DB per server and avoids cross-host WAL/SHM issues.
Durable fix ideas:
Detect NFS (statfs 0x6969) and either warn or force a local DB dir.
Add a configurable DB location override (env var) so users can opt into local storage.
Optional: disable WAL on NFS or add integrity checks + auto-recovery.
If this aligns with maintainers’ direction, I’m happy to help craft a PR that adds NFS detection + local fallback + explicit override.
How to disable sqlite? And continue using files. Don't see any benefits actually.
I'm using devcontainers and several worktrees and mount the same XDG folder. Separate db instance will make sessions not sharable between them
Does it mean that we cannot share the database at all? All sessions will be saved for a particular container only.
Unless you implement something to migrate session info from one DB to another (or somehow mount the db to the container... likely one mount at a time), then I do think that's what it means.
@thdxr any chance this issue could get some love? It's really frustrating to break sqlite over and over again accidentally 🥲
At the beginning, I mounted the .local/share folder from the container to a volume and bound the auth.json file from the host. It worked as a workaround. But then, when I wanted to continue the session, I realized that I needed to find the exact container to do so. Then I saw a bug with the light theme and white letters.
It's not a real solution but at least if the corruption happens to you you don't need to lose everything and can go back to your previous session and ask the model to continue. It also doesn't work on every type of corruption so if you're very unlucky, well...
Activity
fix: switch SQLite from WAL to DELETE journal mode to prevent corruption
dejwi commentedon Feb 21, 2026
same
Miskamyasa commentedon Feb 25, 2026
Same issue
Dulani commentedon Feb 27, 2026
This looks very similar to #14970 (NFS/WAL corruption), just via a different trigger. In our case the corruption didn’t come from local + Docker, but from two different servers sharing the same NFS home directory. The underlying pattern is the same: multiple opencode processes on different “hosts” are writing to the same global SQLite DB (~/.local/share/opencode/opencode.db), and WAL/SHM is not safe across NFS clients.
Why it was a problem for us:
Workaround that fixed it:
export XDG_DATA_HOME="/home/RAND.ORG/dwoods/.local/share/opencode-vincent"
Durable fix ideas:
If this aligns with maintainers’ direction, I’m happy to help craft a PR that adds NFS detection + local fallback + explicit override.
Miskamyasa commentedon Feb 27, 2026
How to disable sqlite? And continue using files. Don't see any benefits actually.
I'm using devcontainers and several worktrees and mount the same XDG folder. Separate db instance will make sessions not sharable between them
Miskamyasa commentedon Mar 3, 2026
Does it mean that we cannot share the database at all? All sessions will be saved for a particular container only.
Dulani commentedon Mar 3, 2026
Unless you implement something to migrate session info from one DB to another (or somehow mount the db to the container... likely one mount at a time), then I do think that's what it means.
igorwang commentedon Mar 5, 2026
Same issue
tdgroot commentedon Mar 7, 2026
Just found out the hard way as well 😅
Miskamyasa commentedon Mar 9, 2026
What options do we have? Still on 1.1.63 because of this and can not use GPT 5.4 models
Miskamyasa commentedon Mar 11, 2026
Guys, three weeks have passed. Maybe we can add a variable, perhaps OPENCODE_AVOID_SQLITE or something, to prevent SQLite usage?
d4rky-pl commentedon Mar 16, 2026
@thdxr any chance this issue could get some love? It's really frustrating to break sqlite over and over again accidentally 🥲
Miskamyasa commentedon Mar 17, 2026
At the beginning, I mounted the
.local/sharefolder from the container to a volume and bound the auth.json file from the host. It worked as a workaround. But then, when I wanted to continue the session, I realized that I needed to find the exact container to do so. Then I saw a bug with the light theme and white letters.Rolled back to 1.1.63
d4rky-pl commentedon Mar 18, 2026
opencode-db-unfuck(uncorrupts your sqlite):It's not a real solution but at least if the corruption happens to you you don't need to lose everything and can go back to your previous session and ask the model to continue. It also doesn't work on every type of corruption so if you're very unlucky, well...
erlinerd commentedon Mar 20, 2026
Same issue
jeffdev11 commentedon Mar 30, 2026
same issue
Update Dockerfile
randommm commentedon Apr 30, 2026
it seems to have solved the problem for me to mount the directories according to the current working dir:
e.g. from https://github.com/randommm/opencode:
github-actions commentedon 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.