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 system leaks tmp_pack_* files indefinitely, filling disk at ~9.5 GB/hour #14811
The OpenCode snapshot system creates tmp_pack_* files in the git object store under ~/.local/share/opencode/snapshot//objects/pack/ and never cleans them up. These files accumulate at approximately one new ~9.5 GB file per hour while OpenCode is running, and persist after OpenCode exits. This will silently fill any disk to 100% capacity over time.
These issues describe the same tmp_pack file accumulation problem in the snapshot system. Please review them and consider adding your findings there instead, or confirm if your issue represents a distinct case.
I think i know why this is happening
1.Failed Snapshots: Every time you interact with the AI, OpenCode tries to snapshot your workspace. If your project is large (or if you accidentally run it in your home directory), these operations can hang.
2.Orphaned Files: When the process hangs or is killed, it leaves those tmp_pack_... files in your .local/share/opencode/.../objects/pack folder.
3.No Auto-Cleanup: The current version of OpenCode (as of early 2026) doesn't have a built-in mechanism to delete these temporary files automatically once they've failed.
Hit this on v1.2.16 — 533GB consumed on a 1.1TB disk (filled to 100%).
Breakdown of the snapshot dir before cleanup:
Project snapshot (0e0047...): 270GB total — three abandoned tmp_pack_* files (125G + 72G + 72G) plus a corrupted 749M pack file
global snapshot: 264GB total — one 58G tmp_pack_* file plus ~206GB of loose objects across 258 hash directories (averaging 1.3GB each)
5 other snapshots: ~92MB combined (normal)
The loose object accumulation in global seems like a separate-but-related issue — write-tree creates tree objects that stay reachable from the index, so git gc --prune=7.days can't actually prune them. On top of that, when gc does try to repack, it fails (likely OOM or disk pressure) and leaves the tmp_pack_* files behind, compounding the problem.
I just found this issue after hitting 100% disk usage, causing opencode to crash. Found the same snapshot folder taking up 163GB of space for me. What is the solution to handling this safely for now? Between this and the memory leak issues, I'm struggling to use opencode for any length of time without running into performance issues.
I had 120GB if tmp_* files. There are a bunch of pak files that i'm not sure what they are for and the downside of removing them. Most are ~40MB or less, but one is 40GB. Removing the tmp files at least cleaned things up for a bit.
of that, tmp_pack_* files alone accounted for about 19.4 GiB
Examples from that directory:
tmp_pack_MzfB9A = 15G
tmp_pack_HzAeAw = 2.9G
tmp_pack_LAQ6cW = 912M
Important detail
these files were not open by any process when I inspected the snapshot dir itself
deleting only the tmp_pack_* files reclaimed about 19-20 GiB immediately
the containing snapshot dropped from 40G to 20G
free space on the data volume jumped from about 8.5 GiB to 28 GiB
This strongly suggests abandoned/incomplete git repack artifacts are being left behind without cleanup/rollback/GC.
I also had stale leaked .opencode serve processes from a separate test issue keeping opencode.db open, but those do not explain the tmp_pack_* accumulation itself.
This should be partially addressed by commit 0a80ef4 which adds a 2MB file size limit for snapshotting. Large files are now excluded from snapshots, reducing tmp_pack accumulation from large files.
A fix for this is now available in PR #46037: it prunes stale tmp_pack_* files after every snapshot gc run (success or failure) and rebuilds the snapshot store when gc fails on missing objects (the deterministic unable to read mode when the project's own gc prunes shared objects). Details and a reproducer in #46034.
Activity
github-actions commentedon Feb 23, 2026
This issue might be a duplicate of existing issues. Please check:
These issues describe the same tmp_pack file accumulation problem in the snapshot system. Please review them and consider adding your findings there instead, or confirm if your issue represents a distinct case.
amansingh107 commentedon Feb 23, 2026
I think i know why this is happening
1.Failed Snapshots: Every time you interact with the AI, OpenCode tries to snapshot your workspace. If your project is large (or if you accidentally run it in your home directory), these operations can hang.
2.Orphaned Files: When the process hangs or is killed, it leaves those tmp_pack_... files in your .local/share/opencode/.../objects/pack folder.
3.No Auto-Cleanup: The current version of OpenCode (as of early 2026) doesn't have a built-in mechanism to delete these temporary files automatically once they've failed.
Bewinxed commentedon Mar 4, 2026
Hit this on v1.2.16 — 533GB consumed on a 1.1TB disk (filled to 100%).
Breakdown of the snapshot dir before cleanup:
0e0047...): 270GB total — three abandonedtmp_pack_*files (125G + 72G + 72G) plus a corrupted 749M pack fileglobalsnapshot: 264GB total — one 58Gtmp_pack_*file plus ~206GB of loose objects across 258 hash directories (averaging 1.3GB each)The loose object accumulation in
globalseems like a separate-but-related issue —write-treecreates tree objects that stay reachable from the index, sogit gc --prune=7.dayscan't actually prune them. On top of that, whengcdoes try to repack, it fails (likely OOM or disk pressure) and leaves thetmp_pack_*files behind, compounding the problem.WSL2 Ubuntu, git 2.43.0. Fix was
rm -rf ~/.local/share/opencode/snapshot/*— freed 533GB instantly.rothnic commentedon Mar 9, 2026
I just found this issue after hitting 100% disk usage, causing opencode to crash. Found the same snapshot folder taking up 163GB of space for me. What is the solution to handling this safely for now? Between this and the memory leak issues, I'm struggling to use opencode for any length of time without running into performance issues.
I had 120GB if tmp_* files. There are a bunch of pak files that i'm not sure what they are for and the downside of removing them. Most are ~40MB or less, but one is 40GB. Removing the tmp files at least cleaned things up for a bit.
Git-on-my-level commentedon Mar 18, 2026
Confirming this on macOS with a local reproduction and concrete cleanup numbers.
Environment
~/.local/share/opencodeWhat I found locally
~/.local/share/opencodehad grown to45Gsnapshot/was40G~/.local/share/opencode/snapshot/01adec10548001d548c6d7c392e733d8e7535c65=40Gobjects/pack/=39Gtmp_pack_*files alone accounted for about19.4 GiBExamples from that directory:
tmp_pack_MzfB9A=15Gtmp_pack_HzAeAw=2.9Gtmp_pack_LAQ6cW=912MImportant detail
tmp_pack_*files reclaimed about19-20 GiBimmediately40Gto20G8.5 GiBto28 GiBThis strongly suggests abandoned/incomplete git repack artifacts are being left behind without cleanup/rollback/GC.
I also had stale leaked
.opencode serveprocesses from a separate test issue keepingopencode.dbopen, but those do not explain thetmp_pack_*accumulation itself.thdxr commentedon Mar 25, 2026
This should be partially addressed by commit 0a80ef4 which adds a 2MB file size limit for snapshotting. Large files are now excluded from snapshots, reducing tmp_pack accumulation from large files.
arthurjd commentedon Aug 29, 2026
A fix for this is now available in PR #46037: it prunes stale
tmp_pack_*files after every snapshot gc run (success or failure) and rebuilds the snapshot store when gc fails on missing objects (the deterministicunable to readmode when the project's own gc prunes shared objects). Details and a reproducer in #46034.