Repository navigation
Description
Environment
- App: OpenCode Desktop
- Version: 1.17.8
- Platform: macOS arm64
- Electron: 42.3.3
- Node: 24.15.0
Problem
OpenCode Desktop became unresponsive while opening/rendering an existing session, then crashed from the Electron main process.
The app first showed:
OpenCode is not responding
You can relaunch the app, open the logs, or keep waiting.
After choosing relaunch, Electron showed:
Uncaught Exception:
TypeError: Object has been destroyed
at BrowserWindow.<anonymous> (.../app.asar/out/main/index.js:1268:76)
at BrowserWindow.emit (node:events:509:28)
at WebContents.<anonymous> (node:electron/js2c/browser_init:2:18806)
at WebContents.emit (node:events:509:28)
at .../app.asar/out/main/index.js:3322:11
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
Evidence from redacted local inspection
The renderer unresponsive sampler pointed at timeline construction:
renderer unresponsive
at oc://renderer/assets/session-LOcZksCR.js:10169:53
at Array.some (<anonymous>)
at oc://renderer/assets/session-LOcZksCR.js:10169:18
at Proxy.reduceRight (<anonymous>)
at Object.constructMessageRows (oc://renderer/assets/session-LOcZksCR.js:10167:55)
at createTimelineProjection (oc://renderer/assets/session-LOcZksCR.js:10310:27)
I inspected the local SQLite state and found one user message with a very large summary.diffs payload:
summary.diffs count: 11878
summary.diffs size: about 6.88 MB
unique files: 11878
The relevant renderer code appears to deduplicate diffs with this pattern:
(userMessage.summary?.diffs ?? []).reduceRight((result, diff2) => {
if (!isSummaryDiff(diff2)) return result;
if (result.some((item) => item.file === diff2.file)) return result;
result.push(diff2);
return result;
}, []).reverse();Because all files were unique, result.some(...) was close to a worst-case synchronous main-thread path.
The main-process crash appears to be a separate race during relaunch/window recovery: out/main/index.js:1268 accesses win.webContents.getURL() from the responsive handler after the BrowserWindow has already been destroyed.
Expected behavior
The desktop app should remain responsive even when a session has a large diff summary. Relaunching or recovering from an unresponsive renderer should not throw an uncaught main-process exception.
Actual behavior
The renderer hangs while constructing the timeline, then the main process can crash with TypeError: Object has been destroyed during relaunch/recovery.
Suggested fixes
- Use a
Set-based linear pass for diff deduplication instead ofresult.some(...)insidereduceRight. - Consider capping, lazy-rendering, or virtualizing very large
summary.diffspayloads. - Guard main-process event handlers before accessing
win.webContents, e.g. checkwin.isDestroyed()andwin.webContents.isDestroyed()inresponsive,unresponsive,render-process-gone, and load-failure handlers.
Workaround
Clearing the oversized summary.diffs field for the affected local message allows the app to open again. I am not attaching the exported debug zip because it may contain local paths and session data, but I can provide redacted logs if needed.
Activity
github-actions commentedon Jun 20, 2026
This issue might be a duplicate of existing issues. Please check:
TypeError: Object has been destroyedElectron main-process crash on macOS Desktop — identical stack trace and root cause (WebContents event firing after BrowserWindow is destroyed)Please review the above issues to see if your report is already covered. If your issue is distinct (e.g., the
summary.diffspayload size angle is new), please add a note explaining the difference.ZhongYanZhiShi commentedon Jun 20, 2026
Supplementary information
AntonyLeons commentedon Jul 2, 2026
I hit this hot path on OpenCode Desktop 1.17.13 / macOS arm64 when the agent spun up parallel shells and generated a large number of file changes. the PR looks good and I'd recommend merging as this is a performace optimization too