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
opencode creates identical temp files everytime it runs #6523
I run opencode stats periodically to monitor my token and tool usage.
However, I found a new Library file .*-00000000.so is created under /tmp directory whenever I run opencode. The file is not removed after opencode is terminated.
Each file is sized ~4.1MB. These behaviours consumed 60+ GB just over a night.
ls -l /tmp/.*.so -> if there are these files, delete them to start test from scratch
Start opencode
Invoke /exit
ls -l /tmp/.*.so
witness there are new matching files in /tmp
This test doesn't produce .*.hm files, though, maybe those are created when the model is actually used. I do believe they are also relevant, because they otherwise follow the same naming pattern, e.g. /tmp/.7cfffffbb7f1ed57-00000000.hm.
Using opencode serve on a remote VPS, this issue was eating up drive space and breaking orchestration. As a workaround I did the following (possibly not safe - but hasn't broken me yet):
6 months later, still very much an issue. Really feeling what @khwong-c said:
TBH, I would like this issue to be addressed by a human, sincerely.
Have we seriously turned software development into talking to automated voice messaging systems? Because people seemed to love those and they worked so well?
I thought that running opencode stats is a very harmless thing and did it in loop in my terminal: watch -n 2 "opencode stats" to monitor some metrics while working.
After a few hours my /tmp folder was full of .9dfdcffffcfabcbd-00000000.so-like files. My system start jitterring, I begin to investigate. The first query in google give me possible rootkit activity and the evening starts heating up. I was near to reinstalling my system, at least, thinking where to backup my data urgently. Finally after 2 hours of investigation with virustotal and lsof for files, I ended up with this issue and this comment.
Guys please escalate priority for that issue, it is definitely not minor.
The subsequent run should not create new similar .so file, at least opencode should clean up it after exit.
Thinking of fixing it, but I am not very familiar with typescript, I am a Python developer. If someone going to do it urgently feel free to do so.
For the reference, my investigation flow:
I restarted Firefox/Pycharm, thinking one of them is the issue
in an end of day, I did sudo apt update as my regular routine
the apt says 'no free space on device' or smth
I did df -hT to clear the things up
and see tmpfs /tmp has 0 bytes of free space
then ls -lha /tmp gives me approximately 7000 results
then google said possible rootkit activity
~2 hours of working with lsof, virustotal, etc
and now I am here
I think this can happen to everyone so I writing things up in details.
Update: the unbounded native-library temp-file growth described here is fixed in OpenCode V2.
As of V2 build 0.0.0-dev-17643, the compiled CLI uses Bun 1.4.0-canary.1 (681a49bee). That runtime includes oven-sh/bun#29587, which replaces the unique temporary .so/.dylib/.node extraction on every load with a deterministic, content-hashed path reused across calls, Workers, processes, and restarts. The V2 build provenance is workflow run 32216069554.
This bounds extraction to one reusable file per embedded native module and user instead of allowing unbounded disk growth. It does not mean the temp directory will contain zero native files, and upgrading does not remove files leaked by older builds; those stale randomly named files can be cleaned up after all older OpenCode processes have stopped.
Reacted by Matt Jackson, Andrey Andreev and Michael Gates
Activity
github-actions commentedon Dec 31, 2025
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
khwong-c commentedon Dec 31, 2025
The situation is closer to what has been mentioned in #5792 . I don't consider this as a security issue at the moment.
However, not cleaning up files after exit and consumes more than 60+ GB is the issue here.
github-actions commentedon Mar 25, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.
eras commentedon Mar 25, 2026
The issue still persists in 1.3.2.
Steps to reproduce:
ls -l /tmp/.*.so-> if there are these files, delete them to start test from scratchopencode/exitls -l /tmp/.*.so/tmpThis test doesn't produce
.*.hmfiles, though, maybe those are created when the model is actually used. I do believe they are also relevant, because they otherwise follow the same naming pattern, e.g./tmp/.7cfffffbb7f1ed57-00000000.hm.khwong-c commentedon Mar 25, 2026
@eras Thanks for confirming. I have stopped using Open Code because of this issue.
TBH, I would like this issue to be addressed by a human, sincerely.
snarkipus commentedon Apr 3, 2026
Using
opencode serveon a remote VPS, this issue was eating up drive space and breaking orchestration. As a workaround I did the following (possibly not safe - but hasn't broken me yet):file:
/etc/systemd/system/opencode-tmp-clean.servicefile:
/etc/systemd/system/opencode-tmp-clean.timerfile:
/usr/local/bin/opencode-tmp-cleanupfix(session): read opencode session list from SQLite, not subprocess (#…
mikew commentedon May 15, 2026
6 months later, still very much an issue. Really feeling what @khwong-c said:
Have we seriously turned software development into talking to automated voice messaging systems? Because people seemed to love those and they worked so well?
khwong-c commentedon May 15, 2026
@mikew I tried to add a tear emoji in your reply but couldn't find one 😂
So here you go: 🥲
andyceo commentedon May 18, 2026
This issue can be serious vulnerability.
I thought that running
opencode statsis a very harmless thing and did it in loop in my terminal:watch -n 2 "opencode stats"to monitor some metrics while working.After a few hours my /tmp folder was full of
.9dfdcffffcfabcbd-00000000.so-like files. My system start jitterring, I begin to investigate. The first query in google give mepossible rootkit activityand the evening starts heating up. I was near to reinstalling my system, at least, thinking where to backup my data urgently. Finally after 2 hours of investigation with virustotal andlsoffor files, I ended up with this issue and this comment.Guys please escalate priority for that issue, it is definitely not minor.
The subsequent run should not create new similar
.sofile, at leastopencodeshould clean up it after exit.Thinking of fixing it, but I am not very familiar with typescript, I am a Python developer. If someone going to do it urgently feel free to do so.
For the reference, my investigation flow:
sudo apt updateas my regular routinedf -hTto clear the things upls -lha /tmpgives me approximately 7000 resultspossible rootkit activitylsof, virustotal, etcI think this can happen to everyone so I writing things up in details.
thdxr commentedon Aug 19, 2026
Update: the unbounded native-library temp-file growth described here is fixed in OpenCode V2.
As of V2 build
0.0.0-dev-17643, the compiled CLI uses Bun 1.4.0-canary.1 (681a49bee). That runtime includes oven-sh/bun#29587, which replaces the unique temporary.so/.dylib/.nodeextraction on every load with a deterministic, content-hashed path reused across calls, Workers, processes, and restarts. The V2 build provenance is workflow run 32216069554.This bounds extraction to one reusable file per embedded native module and user instead of allowing unbounded disk growth. It does not mean the temp directory will contain zero native files, and upgrading does not remove files leaked by older builds; those stale randomly named files can be cleaned up after all older OpenCode processes have stopped.