macOS desktop startup crash when a rollout JSONL contains a huge single line

Open 💬 1 comment Opened Mar 21, 2026 by kaonis

What version of Codex is running?

Codex.app 26.318.11754 (CFBundleVersion 1100)
Installed via Homebrew cask: brew install --cask codex-app

Which model were you using?

Unknown / not relevant. This happens during desktop app startup before normal use.

What platform is your computer?

macOS 26.3.1 (25D2128) on arm64

What steps can reproduce the bug?

  1. Have a rollout-*.jsonl file under ~/.codex/sessions/... with one extremely large line.
  2. Launch the Codex macOS desktop app.
  3. The app fails during startup with a main-process JavaScript exception.

Observed dialog / stack:

A JavaScript error occurred in the main process
Uncaught Exception:
RangeError: Invalid string length
    at [_normalWrite] [as _normalWrite] (node:internal/readline/interface:652:31)
    at ReadStream.ondata (node:internal/readline/interface:263:23)
    at ReadStream.emit (node:events:508:28)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at Readable.push (node:internal/streams/readable:390:5)
    at node:internal/fs/streams:292:14
    at FSReqCallback.wrapper [as oncomplete] (node:fs:670:5)

What did you expect to happen?

Startup should not crash because of a malformed or oversized rollout log.
The app should skip the file, cap line size, or parse it using a streaming approach that does not let readline accumulate an arbitrarily large line in memory.

Additional context

I traced the crash to desktop startup scanning rollout logs for rollout metrics.
The shipped app bundle appears to read rollout-*.jsonl via readline.createInterface(...) during startup.

The file that triggered it on my machine was:

~/.codex/sessions/2026/03/21/rollout-2026-03-21T21-11-23-019d11cf-2c7f-7341-8228-c44709509ba4.jsonl

Its characteristics were:

  • file size: 539303205 bytes
  • line count: 203
  • largest line: about 538928628 bytes on line 17

I independently reproduced the exact same RangeError outside the app by running Node readline against that file.

Workaround

Moving the bad rollout file out of ~/.codex/sessions allowed Codex Desktop to start normally again.

Example workaround:

mkdir -p ~/.codex/quarantine
mv ~/.codex/sessions/2026/03/21/rollout-2026-03-21T21-11-23-019d11cf-2c7f-7341-8228-c44709509ba4.jsonl \
   ~/.codex/quarantine/rollout-2026-03-21T21-11-23-019d11cf-2c7f-7341-8228-c44709509ba4.jsonl.corrupt

Suggested fix

Any of these would avoid taking down the app on startup:

  • refuse to parse rollout lines above a size cap
  • skip malformed / oversized rollout logs during startup metrics aggregation
  • avoid readline for untrusted large JSONL and use a bounded streaming parser
  • isolate rollout metrics parsing so a single bad file cannot crash the main process

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗