Bug: mimo crashes on launch (0xC0000409 / RADAR_PRE_LEAK_64) - Claude Code import reads large transcripts whole-file and OOMs
Description
Summary
mimo crashes immediately on launch and on mimo --help with exit code 0xC0000409 (STATUS_STACK_BUFFER_OVERRUN). Windows Error Reporting logs it as RADAR_PRE_LEAK_64 (heap memory runaway). mimo --version works because it exits before the offending code path.
Root cause: the Claude Code session import runs unconditionally on every startup and reads each ~/.claude/projects/**/*.jsonl file into memory with readFile + String.split("\n"). A single large transcript (in my case 2.5 GB; several others 100–370 MB) OOMs the process. The try/catch around the import can't catch a native OOM abort, so the app is permanently bricked.
Environment
- MiMoCode: 0.1.5 (latest, installed via
mimo.xiaomi.com/install.ps1). Also reproduces on 0.1.4. - OS: Windows 11 25H2 (build 26200.8655) — not OS-specific; see the decisive test below.
~/.claude/projects/: 3.9 GB across 465.jsonlfiles; largest single file 2.5 GB.
Reproduce
- Have a large Claude Code transcript under
~/.claude/projects/<cwd>/<session>.jsonl(mine is 2.5 GB). - Run
mimo --helpormimo→ no output, returns to prompt immediately. - Exit code:
-1073740791(0xC0000409).
mimo --version returns 0.1.5 (exit 0).
Evidence
Launch log (~/.local/share/mimocode/log/*.log) — every attempt ends at the same line:
INFO service=server-proxy version=0.1.5 args=["--help"] process_role=main mimocode
INFO service=db path=...mimocode.db opening database
INFO service=db count=35 mode=bundled applying migrations
<crash - no further log line>
The crash lands right after DB migrations, which is where ClaudeImport.run() executes.
Windows Event Log (Application → Windows Error Reporting, event ID 1001):
EventName: RADAR_PRE_LEAK_64
P1: mimo.exe
P2: 1.3.14.0
P3: 10.0.26200.2.0.0
RADAR_PRE_LEAK_64 = Windows heap-leak pre-warning → the process allocates memory without bound before aborting.
Decisive test — disable the Claude Code import:
$ MIMOCODE_DISABLE_CLAUDE_IMPORT=1 mimo --help
# prints full help, exit code 0
With the import disabled, mimo starts normally on the same machine. This pinpoints ClaudeImport.run() as the crash site.
Ruled out (all verified): binary corruption (fresh download hash-matches installed), AVX2 (CPU has AVX2; baseline build also crashes), PATH/config/home (crashes with an empty data dir too, because the input is ~/.claude/projects/, not the MiMoCode DB), and Windows 25H2 (the import-disabled test runs fine on the same 25H2 machine).
Root cause
packages/opencode/src/session/claude-import.ts:
// parse() - ~line 53
function parse(text: string, sessionId: SessionID) {
const entries = text
.split("\n") // materializes the ENTIRE file into an array of lines
.map((l) => l.trim())
.filter(Boolean)
.flatMap((line) => { try { return [JSON.parse(line)] } catch { return [] } })
...
}
// caller - ~line 275
const parsed = parse(await readFile(file, "utf-8"), sessionId)
readFile loads the whole .jsonl into one JS string, then .split("\n") materializes a second array of all lines, then each line is JSON.parsed. For a 2.5 GB file this peaks at ~5–8 GB and OOMs. The try/catch around ClaudeImport.run() in index.ts can't catch a native OOM abort.
packages/opencode/src/index.ts (~line 162) runs this on every launch, in the critical startup path:
if (!process.env.MIMOCODE_DISABLE_CLAUDE_IMPORT && !process.env.MIMOCODE_CLAUDE_IMPORTED) {
process.env.MIMOCODE_CLAUDE_IMPORTED = "1" // per-process env, not persisted -> re-runs every launch
try { await ClaudeImport.run() } catch (e) { Log.Default.warn("claude-import failed", { e }) }
}
So a single oversized transcript permanently bricks the app — mimo can't start at all, with no size guard and no graceful failure.
Suggested fix
- Stream, don't slurp: read each
.jsonlline-by-line (Bun file streaming / a line reader) instead ofreadFile+split. This alone fixes the OOM. - Don't run on every startup: make the import lazy (only on explicit
mimo session importor first-run), or run it in a separate child process that can't crash the main launch, and/or skip files above a size threshold. - Even with (1), a size guard / memory budget would turn a future oversized file into a graceful skip instead of a hard abort.
Workaround
Set MIMOCODE_DISABLE_CLAUDE_IMPORT=1 (user env var). mimo then starts normally (without Claude Code history import). Archiving the oversized transcripts out of ~/.claude/projects/ also unblocks the import.
Plugins
No response
MiMoCode version
No response
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response
Same thing happened to me large json + transcript files killing the import. My Coding curriculum has 160kb of json for each level, i have 14 level of leasrning including tasks checkpoints quiz and a capstone with 10 sessions in each curricum and i have 14 levels in each session... so you count the size... Im just sharing my output!
Reproduced on macOS too, so confirming this is not Windows-specific: with a 2.5 GB transcript under ~/.claude/projects/, mimo --help dies with exit 133 (SIGTRAP native abort), no output, right after the applying migrations log line — same signature as the report. Peak RSS 3.0 GB before the abort.
I have a fix for the read path (suggestions 1 + 3): stream each .jsonl line-by-line instead of readFile + split, plus a per-file size budget (MIMOCODE_IMPORT_MAX_FILE_BYTES, default 512 MB, 0 disables) so an oversized file becomes a logged skip instead of an abort. Applied to both claude-import.ts and codex-import.ts — the codex importer has the identical pattern. Suggestion 2 (stop running the import at startup) is already covered by #1075, so I'm deliberately not touching index.ts.
PR incoming.