anomalyco / anomalyco/opencode
Desktop (macOS): renderer V8 OOM crash loop when pasting large JSON into composer (parsePromptInputV2Editor)
@Hona is already working on this.
Since Aug 21, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- Avg merge
- 7h 2m
- Merged PRs (30d)
- 384
Description
Environment
- OpenCode Desktop 1.18.21 (auto-updated from 1.18.20 right before first crash), macOS arm64, Electron 42.3.3 / Chrome 148 / Node 24.15.0
Summary
Pasting a large nested JSON blob (~165 KB session-export) into the chat composer crashes the renderer with a V8 heap OOM abort (render-process-gone, reason: crashed, exitCode: 5). If the pasted payload persists in the composer's prompt-history store, every subsequent app launch re-feeds it through the same parser and the renderer OOMs again within ~17 s — an unbootable crash loop.
Evidence
Both Crashpad minidumps carry identical V8 OOM crash keys and JS stacks:
v8-oom-location: Ineffective mark-compacts near heap limit
#0 (anonymous) oc://renderer/assets/main-DxX1DkV8.js:128219:89
#1 parsePromptInputV2Editor :128219:60
#2 PromptInputV2._el$6.$$input :127950:22
#3 handleNode :1800:64
#4 eventHandler :1821:12
#5 onPaste :129485:66
GC log at death:
3847.2 (3917.9) -> 3847.1 (3917.7) MB ... last resort; GC in old space requested
MarkCompactCollector: young object promotion failed
Heap pinned at ~3.85 GB against V8's ~4 GB ceiling in both crashes:
- Crash 1: paste at T+9 min → ~10 min of ResizeObserver/layout thrash → OOM.
- Crash 2 (relaunch): renderer hit 3.85 GB within 17 s of process start, no user input — consistent with persisted
prompt-historybeing re-parsed on boot.
Ruled out: server-side session data (largest session ≈ 2.4 MB total parts), localStorage/IndexedDB (<150 KB), GPU.
Workaround that unblocked the machine
Delete the oversized entry from the desktop KV store while the app is closed:
sqlite3 "$HOME/Library/Application Support/ai.opencode.desktop/drafts.sqlite" \
"UPDATE document SET value='{\"entries\":[]}' WHERE key LIKE '%prompt-history%';"
(Back up the file first.) Renderer then boots and stays healthy.
Suggested fixes
- Size-clamp paste input in
parsePromptInputV2Editor(reject or truncate above e.g. 1–2 MB with a toast instead of parsing). - Cap per-entry size/count in persisted prompt-history; don't restore entries above the clamp on boot.
- Treat paste-path allocation failures as recoverable (fail soft) rather than letting V8 abort the process.
Happy to share the two .dmp files if useful (Crashpad shows them as pending upload).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.