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
{{ message }}
Repository navigation
OOM crash on startup: Event table snapshot + session revert data grow to 1.4GB, sidecar V8 process runs out of memory #38362
OpenCode Desktop app (v1.18.4, macOS) crashes immediately on startup with OOM error in V8: Zone Allocation failed - process out of memory. The sidecar utility process exits with code 5 before the app becomes usable, leaving the renderer with Failed to load sessions TypeError: Failed to fetch.
Root Cause
The sidecar Node.js process loads the full SQLite database into V8 heap during initialization. Two data fields can grow extremely large for long-running sessions:
The event-sourcing system stores per-session state in the event table with type session.updated.1. For a single session with ~2300 messages, 361 snapshot events accumulated totaling 423 MB, with the latest single event being 423 MB (LENGTH(data) = 423,582,985).
2. Session table — revert column
The session table has a revert column storing undo/rollback state. For the same session, this field grew to 423 MB (LENGTH(revert) = 423,582,308).
Combined, these two fields added ~850 MB of data, pushing the database to 1.4 GB and causing the V8 utility process to OOM on an 8 GB machine.
Evidence
Server log — V8 OOM on every startup:
[OOM error in V8: Zone Allocation failed - process out of memory]
[Mark-Compact 2488.5 (2541.0) -> 1653.9 (1732.3) MB]
SQLite data:
sqlite> SELECT type, COUNT(*), SUM(LENGTH(data)) FROM event WHERE aggregate_id = ? GROUP BY type;
session.updated.1|361|423825317
message.updated.1|3924|301396010
sqlite> SELECT id, LENGTH(revert) FROM session ORDER BY 2 DESC LIMIT 1;
ses_1634c9ccbffeTB36yzKdrsFVpV|423582308
Discussion
session.updated.1 events are state snapshots in the event-sourcing pattern. Messages and parts are stored independently in the message and part tables, so the snapshot is a performance optimization, not the source of truth. Deleting oversized snapshots restored normal operation with all 4536 messages across 38 sessions intact.
The revert column stores serialized undo state. A single 423 MB revert payload suggests unbounded growth with no pruning mechanism.
Suggestions
Cap snapshot/compaction sizes: Implement a configurable or hard limit on session.updated.1 event data size. When compaction produces a snapshot over a threshold, skip storing it and fall back to replaying individual events.
Revert data limits: Cap or periodically prune the revert field. A 400 MB+ revert payload for one session is unusable.
Graceful startup: If the database is too large to fit in available V8 heap, consider loading sessions lazily or showing a cleanup prompt instead of crashing the sidecar.
Memory Megathread #20695: Memory Megathread — central tracking issue for memory-related crashes; maintainers are actively collecting heap snapshots there
If your issue is specifically about the OOM-on-startup crash rather than general memory growth, it may still be worth cross-referencing these so the team can address the compaction/pruning problem holistically.
Related case confirmed on OpenCode Desktop 1.18.4 for Windows.
My database is already approximately 2.49 GB and Desktop freezes repeatedly, although the sidecar has not yet crashed with V8 OOM because the machine has 32 GB of RAM.
Important difference from this report:
session.revert: empty
session.summary_diffs: empty
PRAGMA quick_check: ok
PRAGMA freelist_count: 0
In this case, the dominant growth is the durable event log:
message.updated.1: 2,030,847,015 bytes
A single session aggregate: 1,891,336,715 bytes
This suggests there are multiple paths to the same memory/performance risk in 1.18.4: oversized session snapshots/revert data and unbounded message.updated.1 history.
Activity
github-actions commentedon Jul 22, 2026
This issue might be a duplicate of existing issues. Please check:
eventtable: opencode.db reaches 13GB+, mostlymessage.updated.1snapshots (no retention/compaction) #33356: Unbounded growth of theeventtable — same root cause (no retention/compaction on event snapshots), same symptom of the DB growing to multi-GB sizes and causing OOM/disk exhaustionIf your issue is specifically about the OOM-on-startup crash rather than general memory growth, it may still be worth cross-referencing these so the team can address the compaction/pruning problem holistically.
rafaelbn commentedon Jul 23, 2026
Related case confirmed on OpenCode Desktop 1.18.4 for Windows.
My database is already approximately 2.49 GB and Desktop freezes repeatedly, although the sidecar has not yet crashed with V8 OOM because the machine has 32 GB of RAM.
Important difference from this report:
session.revert: emptysession.summary_diffs: emptyPRAGMA quick_check:okPRAGMA freelist_count:0In this case, the dominant growth is the durable event log:
message.updated.1: 2,030,847,015 bytesThis suggests there are multiple paths to the same memory/performance risk in 1.18.4: oversized session snapshots/revert data and unbounded
message.updated.1history.Full database breakdown:
#33356 (comment)
github-actions commentedon Sep 22, 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.