GeezerVison is showing github.com — [Bug]: Renderer crashes with TypeError: Failed to fetch in fetchMessages when background subagent completes · Issue #27292 · anomalyco/opencode
[Bug]: Renderer crashes with TypeError: Failed to fetch in fetchMessages when background subagent completes #27292
Description
Description
OpenCode GUI (Electron renderer) crashes with TypeError: Failed to fetch when a background subagent task completes and the parent session tries to fetch updated messages. The crash kills the entire session — no recovery possible without restarting OpenCode.
Environment
- OpenCode: 1.14.48
- OmO (oh-my-openagent): 4.1.1
- OS: Windows 11
- Model: claude-opus-4-6
Stack trace
TypeError: Failed to fetch
at fetch (oc://renderer/assets/main-Cb1WDiRx.js:114735:45)
at request (oc://renderer/assets/main-Cb1WDiRx.js:71162:24)
at async retry (oc://renderer/assets/main-Cb1WDiRx.js:75706:14)
at async fetchMessages (oc://renderer/assets/main-Cb1WDiRx.js:77478:24)
at async loadMessages (oc://renderer/assets/main-Cb1WDiRx.js:77502:7)
at async Promise.all (index 1)
at async oc://renderer/assets/main-Cb1WDiRx.js:77660:13
Reproduction
- Start OpenCode TUI/GUI
- In a session, spawn a background task:
task(subagent_type="explore", load_skills=[], run_in_background=true,
prompt="Return exactly: TEST")
- Wait for
<system-reminder> notification that task completed
- Renderer crashes with the above stack trace
- Session is lost
Observations
- The crash happens in
fetchMessages → loadMessages — the renderer tries to fetch messages from the completed child session but the fetch fails
- Backend logs (
~/.local/share/opencode/log/) do NOT contain TypeError or Failed to fetch — this is purely renderer-side
- The crash is intermittent but frequent (observed multiple times in one session)
- Backend background task infrastructure works correctly — the task completes, result is available via API. The crash is in the UI layer consuming the completion event
Possibly related
Suggested investigation
The fetchMessages call in the renderer likely races with the session lifecycle — the child session may be cleaned up or rotated before the renderer's loadMessages call resolves. A guard or retry with session-existence check before fetch could prevent the crash.
Activity
cy574 commented on May 14, 2026
Same issue here. Can confirm this reproduces with as few as 3 concurrent background agents (not just high concurrency). The /ohmy-opencode-agent-tester skill is a one-click reproducible case.
Test results by concurrency level — all crash:
14 agents → crash
6 agents → crash
3 agents → crash
This suggests the issue is not load-dependent but rather a missing backpressure/throttle mechanism in fetchMessages itself.
Env: OpenCode 1.4.49, Windows 11 Pro 64-bit (Build 10.0.26200),OmO (oh-my-openagent): 4.1.1
github-actions commented on Jul 14, 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.
Metadata
Metadata
Development
No branches or pull requestsIssue actions