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.
Description
OpenCode GUI (Electron renderer) crashes with
TypeError: Failed to fetchwhen 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
Stack trace
Reproduction
<system-reminder>notification that task completedObservations
fetchMessages→loadMessages— the renderer tries to fetch messages from the completed child session but the fetch fails~/.local/share/opencode/log/) do NOT containTypeErrororFailed to fetch— this is purely renderer-sidePossibly related
Suggested investigation
The
fetchMessagescall in the renderer likely races with the session lifecycle — the child session may be cleaned up or rotated before the renderer'sloadMessagescall resolves. A guard or retry with session-existence check before fetch could prevent the crash.