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
Snapshot can recursively ingest its own data when worktree is the home directory #20442
On OpenCode 1.2.24, I hit a disk exhaustion / high-CPU loop caused by the snapshot mechanism when the worktree was the home directory.
In my case, starting opencode serve from /home/<user> resulted in a snapshot repo under ~/.local/share/opencode/snapshot/global, and I observed repeated commands of the form:
The problem is that the snapshot storage directory itself lives inside that same worktree. On this setup, ~/.local/share/opencode/ was visible to the snapshot repo as content under the captured tree instead of being reliably excluded. After process restarts / interrupted snapshot writes, objects/pack accumulated many very large tmp_pack_* files until the disk filled up, while git add kept respawning at high CPU.
This looks like a logic hole around broad worktrees such as /home/<user>: the snapshot repo can end up recursively ingesting its own data.
Expected behavior: snapshot storage should never be snapshotted. OpenCode should either store snapshot data outside the worktree, hard-exclude its own data directory, or reject worktrees that contain the OpenCode data directory.
Plugins
None
OpenCode version
1.2.24
Steps to reproduce
Start opencode serve with a worktree that contains the OpenCode data directory, for example /home/<user>.
Let OpenCode initialize snapshot storage under ~/.local/share/opencode/snapshot/....
Restart or interrupt the process while snapshot activity is happening.
Same condition here - the worktree was my home directory, with opencode's own data inside it. My visible symptom was different (no replies, service restarting in a loop), but for anyone landing on this thread the practical fix is worth writing down:
From the folder where you start opencode: git rev-parse --show-toplevel
If it prints your home folder (or another broad parent folder) instead of a real project: that repo is almost certainly accidental - delete that .git (rename if unsure) and start opencode inside an actual project folder. That removes the self-referential snapshot walk entirely.
If it prints a real project of yours: give the giant directories a .gitignore entry, or turn snapshots off with "snapshot": false, so the scan stops walking hundreds of thousands of files.
Deleting the stray ~/.git fixed it completely for me.
Activity
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.
piknockyou commentedon Sep 30, 2026
Same condition here - the worktree was my home directory, with opencode's own data inside it. My visible symptom was different (no replies, service restarting in a loop), but for anyone landing on this thread the practical fix is worth writing down:
From the folder where you start opencode:
git rev-parse --show-toplevel.git(rename if unsure) and start opencode inside an actual project folder. That removes the self-referential snapshot walk entirely..gitignoreentry, or turn snapshots off with"snapshot": false, so the scan stops walking hundreds of thousands of files.Deleting the stray
~/.gitfixed it completely for me.