codex issue
Open 💬 3 comments Opened Jun 14, 2026 by zerkey8504
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
Codex Windows app crashes when typing.
Error: A JavaScript error occurred in the main process.
Uncaught Exception: RangeError: Invalid string length
at JP.write
at Socket.onStdoutData
Windows app version: 26.609.4994.0_x64
I already tried Repair, Reset, reinstalling, and restarting.
3 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I can reproduce the same main-process crash on macOS with the same
JP.write -> Socket.onStdoutDatashape. Adding sanitized local details in case it helps triage.Environment
26.609.71450(CFBundleVersion3965), bundle idcom.openai.codexcodex-cli 0.139.0/Applications/Codex.appError dialog
Observed behavior
osascript -e 'tell application id "com.openai.codex" to quit'returneduser canceled (-128).SIGTERMto the main/Applications/Codex.app/Contents/MacOS/Codexprocess, I also cleaned up leftoverCodex Radar Sentinel,crashpad_handler,bare-modifier-monitor, and oldcodex app-server/node_replhelper processes.Size clue
This machine has a very large Codex session store:
The crash happened after long, media-heavy Codex Desktop usage. This seems consistent with the hypothesis in #22004 that the desktop main process is buffering a large runtime/stdout payload into one JS string and eventually hitting V8's maximum string length. The important difference here is that this is on macOS/Apple Silicon and on app version
26.609.71450, with the minified writer name now showing asJP.write.Further debugging update from the same macOS repro, with local content redacted.
What I found
The crash was tied to one specific conversation. Opening that conversation in Codex Desktop triggered the
RangeError: Invalid string lengthdialog immediately.The matching local rollout file under
~/.codex/sessions/<yyyy>/<mm>/<dd>/rollout-<redacted>.jsonlhad grown to about 1.9 GB:Structural stats from parsing the JSONL, without printing private message content or image bytes:
The large payloads were not normal terminal output.
function_call_outputtext output was only a small part of the useful history. The growth came from image payloads being persisted inline in multiple places:Approximate byte distribution before recovery:
After replacing only embedded image/base64 strings with a tiny 1x1 PNG placeholder while preserving the JSONL event structure and all text fields:
After that rewrite, Codex Desktop launched again without the
Invalid string length/JP.write/Socket.onStdoutDatacrash. The tradeoff is that historical generated/attached images in that conversation become placeholders, but the text history and event structure remain loadable.Inferred failure mode
This looks like a session-loading / stdout-framing issue rather than a renderer issue:
replacement_history, multiplying the same large strings.JP.writein this build) appears to aggregate stdout into one JavaScript string.RangeError: Invalid string lengthis thrown uncaught, leaving the app in a crash loop / non-dismissible modal state.Suggested fix directions
A robust fix probably needs more than raising a limit:
replacement_history, or replace them with stable artifact references before compaction.image_url,result, anddatafields.RangeErroraround the stdout writer so one bad session cannot crash the whole app.~/.codex/sessions.This was reproduced on macOS/Apple Silicon with Codex app
26.609.71450(CFBundleVersion3965). The stack in the dialog was the same shape as above:JP.write -> Socket.onStdoutData -> Readable.push -> Pipe.onStreamRead.