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
While opencode is waiting for API limit rate - actually doing nothing -
Resource has been exhausted (e.g. check quota). [retrying in 18m 12s attempt #12]
It's actually using ~50% of single core on i9-14900 CPU
Plugins
nothing
OpenCode version
1.3.3
Steps to reproduce
I was working on a project using gemini api tier 1, quickly exhausted my limit, while waiting I noticed that opencode is using this much CPU on htop.
system performance is fine, I've many applications running including browsers, but only opencode is using this much CPU
If your issue is distinct (specifically tied to the rate-limit retry waiting loop rather than general idle CPU usage), please clarify in this issue. Otherwise, consider adding your findings to the existing report.
This is absolutely still an open issue, and post-close comments on #4804 (it tops the Google search so most of your users are actually ending there when searching for CPU issues in opencode) prove it, there's comments up to very recently reporting that the original problem has not been closed. Opencode is hitting four cores at about 60-70% on my M1 MBP Max consistently which is A LOT for streaming blocks of text back and forth.
Same here, MacBook Apple M4 Pro, Tahoe, 24GB, now keeps heating and can only last for less than 3 hours by doing nothing, opencode is the only process takes high CPU usage (without task execution).
Same here on Linux Kubuntu 25.10 on Ryzen R9-5900HS with OpenCode version 1.14.25, it takes 50% of CPU with doing nothing. When model is running it takes almost 100% but model is remote so this is weird. Flatpak version 1.4.0 behaves the same almoast permnent CPU load.
I see this in OpenCode 1.14.41 on Linux Mint 22.2.
This issue may have the same cause as #13899, which was automatically closed, but may be solved by PR #13901 that simply limits the frame rate of the web UI.
If you are experienced with TypeScript, please help to test PR #13901!
Same on arch, terminal wezterm. Everything bleeding edge. Busyloop triggers by simply sending a prompt. It's somewhat sporadic, either it happens or it doesn't. Some models trigger the busyloop bug more than others (eg deepseek flash gets "stuck" busy looping almost always, and then suddenly 2 screen of text appear at once, vs glm which is slow and somehow avoids the busyloop).
Someone who knows how to use profiler in bun will have to look into this.
strace shows (mostly) this when busylooping. seems like someone (bun?) is using a spinlock while it shouldn't.
This is a very real issue! There is a (closed/abandoned) feature request to limit the TUI FPS here, where I just engaged: #13817
Here is a blurb I posted there, with the actual script in the comment on that issue in the link below.
Unsupported workaround: Binary patch OpenCode TUI to throttle FPS
(targets binary in official Docker image ghcr.io/anomalyco/opencode)
While native FPS configuration is being considered...
I developed a binary-patch workaround that makes a copy of the opencode binary with both targetFps and maxFps set as specified. You can easily make separate binaries for different uses, e.g. opencode-fps-30, opencode-fps-10, opencode-fps-1, etc.
At some point in the future when OpenCode changes the relevant code, this patch will no longer work (but it should fail gracefully as opposed to created a corrupt binary).
This patch is provided for experimentation, with no warranties. Review the script before running it.
My Macbook becomes crazy hot even when kept idle. Even when opencode is not open in any window an opencode process keep running which has to be force closed.
Tried disabling fff with OPENCODE_DISABLE_FFF=1 (verified in env) and it made zero difference. $HOME isn't a git repo either so it's not the git status polling issue (#21699). No child processes running, 41 FDs open, just sitting idle on an established connection.
Looks like a tight busy-wait loop in the event bus / SDK layer. epoll_pwait2 immediately returns ready and spins sched_yield ~7k times/sec instead of actually sleeping. Bun's GC (HeapHelper) constantly sits at ~40% combined CPU just trying to keep up with the allocations from whatever loop is running.
Something to add to this thread — the failure mode I'm hitting doesn't match most of the reports here. The process doesn't just spin until I force-quit it; it terminates itself.
Sequence:
Runs normally for a while.
CPU suddenly pins a core at ~100% — the whole laptop stalls at this point, not just OpenCode.
While still spiking, OpenCode kills itself. No manual kill needed.
Digging through the source, there are at least two paths that would produce a self-termination under load:
Explicit exit on an escaped error. In packages/opencode/src/index.ts the top-level handler ends with finally { process.exit() }, so any error that escapes a command handler prints "Unexpected error" and exits the process.
Neither of those seems to be called out in this thread yet, which is why I'm adding it here instead of opening a new issue.
Happy to supply logs, exact version, platform, and a dmesg | grep -i "killed process" OOM check if that helps narrow down which path it is.
Correction to my comment above: I'm on v2 (@opencode/cli, managed serve --service), not 1.18.x — I should have checked before posting.
So the self-termination detail belongs with the v2 trackers, and I've added it to #51852 (the v2 Linux idle-spin / liveness-kill report). Leaving this comment here since the exit-on-escaped-error path in index.ts and the watchdog cross-refs are shared between trees, but the v2 thread is where my case actually lives.
Possibly useful for anyone else landing here on v2: the follow-up in #50591 describes a trigger worth checking — a stray .git above the working directory makes OpenCode treat a very large tree as the project and re-scan it (~26s per pass, twice per message). That exceeds the watchdog window, so the service looks dead and gets replaced.
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.
Activity
github-actions commentedon Mar 27, 2026
This issue might be a duplicate of existing issues. Please check:
If your issue is distinct (specifically tied to the rate-limit retry waiting loop rather than general idle CPU usage), please clarify in this issue. Otherwise, consider adding your findings to the existing report.
gearwatcher commentedon Apr 4, 2026
This is absolutely still an open issue, and post-close comments on #4804 (it tops the Google search so most of your users are actually ending there when searching for CPU issues in opencode) prove it, there's comments up to very recently reporting that the original problem has not been closed. Opencode is hitting four cores at about 60-70% on my M1 MBP Max consistently which is A LOT for streaming blocks of text back and forth.
wjrforcyber commentedon Apr 17, 2026
Same here, MacBook Apple M4 Pro, Tahoe, 24GB, now keeps heating and can only last for less than 3 hours by doing nothing, opencode is the only process takes high CPU usage (without task execution).
imp4ct7 commentedon Apr 25, 2026
Same here on Linux Kubuntu 25.10 on Ryzen R9-5900HS with OpenCode version 1.14.25, it takes 50% of CPU with doing nothing. When model is running it takes almost 100% but model is remote so this is weird. Flatpak version 1.4.0 behaves the same almoast permnent CPU load.
oliver-joos commentedon May 9, 2026
I see this in OpenCode 1.14.41 on Linux Mint 22.2.
This issue may have the same cause as #13899, which was automatically closed, but may be solved by PR #13901 that simply limits the frame rate of the web UI.
If you are experienced with TypeScript, please help to test PR #13901!
ezdiy commentedon May 12, 2026
Same on arch, terminal wezterm. Everything bleeding edge. Busyloop triggers by simply sending a prompt. It's somewhat sporadic, either it happens or it doesn't. Some models trigger the busyloop bug more than others (eg deepseek flash gets "stuck" busy looping almost always, and then suddenly 2 screen of text appear at once, vs glm which is slow and somehow avoids the busyloop).
Someone who knows how to use profiler in bun will have to look into this.
strace shows (mostly) this when busylooping. seems like someone (bun?) is using a spinlock while it shouldn't.
Retamogordo commentedon May 30, 2026
Same on Ubuntu 22.04, opencode version 1.15.12.
life00 commentedon Jun 17, 2026
Same here on Fedora 42, opencode version 1.17.7
gdevenyi commentedon Jun 17, 2026
I'm seeing this right now for
Usage limit reached for 5 hour. Your limit will reset at 2026-06-18 03:02:54 [retrying in 7m 41s attempt #9]Huge cpu usage spinning away waiting. Is it the animation?
viktor-ferenczi commentedon Jun 26, 2026
Yes, it is: #34045
skhaz commentedon Jun 29, 2026
I also have this issue, even with simple sessions
igallart commentedon Jul 6, 2026
Same problem, high cpu doing nothing.
opencode -v
1.17.13
cat /etc/os-release
PRETTY_NAME="Ubuntu 26.04 LTS"
NAME="Ubuntu"
VERSION_ID="26.04"
VERSION="26.04 LTS (Resolute Raccoon)"
VERSION_CODENAME=resolute
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=resolute
LOGO=ubuntu-logo
uname -a
Linux namek 7.0.0-27-generic #27-Ubuntu SMP PREEMPT_DYNAMIC Thu Jun 18 19:13:49 UTC 2026 x86_64 GNU/Linux
jmarcosfer commentedon Jul 7, 2026
Same here,
opencode -v
1.17.14
macOS 15.7.7
MacBookPro15,1
2,2 GHz 6 core i7
16GB RAM
DavidGOrtega commentedon Jul 11, 2026
Same heree every instance eats a full core beyond 100% over time
dkamins commentedon Jul 22, 2026
This is a very real issue! There is a (closed/abandoned) feature request to limit the TUI FPS here, where I just engaged:
#13817
Here is a blurb I posted there, with the actual script in the comment on that issue in the link below.
Unsupported workaround: Binary patch OpenCode TUI to throttle FPS
(targets binary in official Docker image
ghcr.io/anomalyco/opencode)While native FPS configuration is being considered...
I developed a binary-patch workaround that makes a copy of the
opencodebinary with bothtargetFpsandmaxFpsset as specified. You can easily make separate binaries for different uses, e.g.opencode-fps-30,opencode-fps-10,opencode-fps-1, etc.At some point in the future when OpenCode changes the relevant code, this patch will no longer work (but it should fail gracefully as opposed to created a corrupt binary).
This patch is provided for experimentation, with no warranties. Review the script before running it.
See patch posted in comment:
#13817 (comment)
ShreyashKore commentedon Sep 1, 2026
My Macbook becomes crazy hot even when kept idle. Even when opencode is not open in any window an opencode process keep running which has to be force closed.
jm57c commentedon Sep 5, 2026
Same here. Can confirm this is still happening on 1.18.29.
OS: Artix Linux x86_64 (KDE Wayland)
CPU: i7-10610U
Process: opencode TUI (cwd=$HOME)
Sits at ~100%+ CPU on a single core doing completely nothing.
% time seconds usecs/call calls errors syscall
57.06 9.859336 188 52375 2515 futex
25.93 4.480677 16473 272 epoll_pwait2
13.36 2.307910 40 57374 sched_yield
3.30 0.569416 43801 13 4 restart_syscall
Tried disabling fff with OPENCODE_DISABLE_FFF=1 (verified in env) and it made zero difference. $HOME isn't a git repo either so it's not the git status polling issue (#21699). No child processes running, 41 FDs open, just sitting idle on an established connection.
Looks like a tight busy-wait loop in the event bus / SDK layer. epoll_pwait2 immediately returns ready and spins sched_yield ~7k times/sec instead of actually sleeping. Bun's GC (HeapHelper) constantly sits at ~40% combined CPU just trying to keep up with the allocations from whatever loop is running.
keyle commentedon Oct 2, 2026
This is definitely an issue if I'm using opencode TUI as a client
mrvigneshvt commentedon Oct 5, 2026
Something to add to this thread — the failure mode I'm hitting doesn't match most of the reports here. The process doesn't just spin until I force-quit it; it terminates itself.
Sequence:
Digging through the source, there are at least two paths that would produce a self-termination under load:
/api/infostops answering inside the ~6s window, the supervisor treats the service as unresponsive and SIGKILLs it, then respawns. Cross-ref desktop(win): background service SIGKILLed mid-turn when snapshot capture blocks /api/info for >6s -> ~60s restart loop, aborted turns #51216, cli(win): 45s event-stream idle watchdog restarts the managed service, aborting all sessions/subagents #52049 (45s event-stream idle watchdog), 2.0 (linux): managed service main thread intermittently busy-loops in user space while idle (~100% of one core, no log/DB output) #51852 (idle user-space busy-loop on Linux, same ~6s liveness window).packages/opencode/src/index.tsthe top-level handler ends withfinally { process.exit() }, so any error that escapes a command handler prints "Unexpected error" and exits the process.Neither of those seems to be called out in this thread yet, which is why I'm adding it here instead of opening a new issue.
Happy to supply logs, exact version, platform, and a
dmesg | grep -i "killed process"OOM check if that helps narrow down which path it is.mrvigneshvt commentedon Oct 5, 2026
Correction to my comment above: I'm on v2 (
@opencode/cli, managedserve --service), not 1.18.x — I should have checked before posting.So the self-termination detail belongs with the v2 trackers, and I've added it to #51852 (the v2 Linux idle-spin / liveness-kill report). Leaving this comment here since the exit-on-escaped-error path in
index.tsand the watchdog cross-refs are shared between trees, but the v2 thread is where my case actually lives.Possibly useful for anyone else landing here on v2: the follow-up in #50591 describes a trigger worth checking — a stray
.gitabove the working directory makes OpenCode treat a very large tree as the project and re-scan it (~26s per pass, twice per message). That exceeds the watchdog window, so the service looks dead and gets replaced.thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊