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
migrate: V1→V2 session history migration OOMs on sessions with huge base64 file parts #50339
On upgrade, the V1→V2 session history migration crashes every boot with RangeError: Out of memory when an old-schema session contains a very large embedded file part. In my case: a part row of ~279 MB whose data is {"type":"file","mime":"application/pdf","url":"data:application/pdf;base64,..."} (same PDF attached 4x across sessions, plus two ~56 MB blobs). The migration retries from scratch on every server start and dies on the same session, each attempt re-projecting rows into session_message, growing the db to 3.5 GB.
The migration already has a "Skipped V1 migration row" warning path, but it never triggers for these. Suggested fix: process parts without materializing the whole value (stream/omit the blob), or skip parts above a size threshold instead of OOM.
Plugins
local plugin: ~/.config/opencode/plugins/openviking
opencode-antigravity-auth@latest (V1-only, fails to load — unrelated)
superpowers (git)
OpenCode version
2.0.11 (first observed) and 2.0.12 (verified after workaround)
Steps to reproduce
Have an old-schema session (db with session/message/part tables from a pre-V2 build) containing an attached ~280 MB PDF stored as a base64 data: URL part
Upgrade to 2.0.x so the V1→V2 session history migration runs
Start the server
Actual, every boot:
level=ERROR message="V1 migration failed" cause="Cause([Die(RangeError: Out of memory)])"
TUI banner: Data migration failed: Out of memory
GET /api/experimental/migration/v1 → {"status":"error","error":"Out of memory"}
part table: 162k rows / 1.8 GB, single largest LENGTH(data) ≈ 292 MB
Workaround (confirmed): back up the db, DELETE FROM part WHERE LENGTH(data) > 10485760 (and the already-projected session_message copies), restart → migration finishes and the endpoint reports {"status":"completed"}.
I'd like to investigate and work on this. I'll reproduce the migration failure with synthetic large attachments, then look for a bounded-memory fix that preserves session data and handles retries safely. Please let me know if a fix is already underway.
Thanks for the report. We're tracking this same oversized-part migration failure in #50076, so I'm closing this as a duplicate. Please follow that issue for updates.
Activity
onlinerj commentedon Sep 21, 2026
I'd like to investigate and work on this. I'll reproduce the migration failure with synthetic large attachments, then look for a bounded-memory fix that preserves session data and handles retries safely. Please let me know if a fix is already underway.
neriousy commentedon Oct 20, 2026
Thanks for the report. We're tracking this same oversized-part migration failure in #50076, so I'm closing this as a duplicate. Please follow that issue for updates.