Codex Desktop on Windows crashes with RangeError: Invalid string length when opening a specific task card before the task starts

Open 💬 2 comments Opened May 20, 2026 by badseal
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of the Codex App are you using (From “About Codex” dialog)?

26.513.4821.0

What subscription do you have?

chatgpt plus

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What issue are you seeing?

Codex Desktop crashes with a JavaScript main-process error when opening a specific task card. The task does not need
to start running. The crash happens while the app is rendering/loading the task content.

Affected conversation ID:

019e44a4-96d3-7e42-afd7-94aab09a3bb4

Error dialog:

```text
A JavaScript error occurred in the main process

Uncaught Exception:
RangeError: Invalid string length
at fd.write (...)
at Socket.onStdoutData (...)
at Socket.emit (node:events:509:28)
at addChunk (node:internal/streams/readable:563:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:514:3)
at Readable.push (node:internal/streams/readable:394:5)
at Pipe.onStreamRead (node:internal/stream_base_commons:189:23)

Relevant local log entries with PII redacted:

2026-05-20T09:23:21.207Z error [electron-message-handler] Item not found in turn state
itemId=call_e8g1oRJmjPYq9zz3NjY9ltjn

2026-05-20T09:23:29.786Z info [electron-message-handler] turn_completed_with_incomplete_plan completedPlanStepCount=4
conversationId=019e44a4-96d3-7e42-afd7-94aab09a3bb4 planStepCount=5 turnId=019e44a7-2972-76d2-bc35-27851444a31e

2026-05-20T09:35:25.851Z info [AppServerConnection] response_routed broadcastFallback=false conversationId=019e44a4-
96d3-7e42-afd7-94aab09a3bb4 durationMs=1 errorCode=null hadInternalHandler=false hadPending=true method=turn/start

This appears to be a desktop UI/state handling issue rather than a task execution failure. The crash occurs while
opening/rendering the task card.

What steps can reproduce the bug?

  1. Open Codex Desktop on Windows.
  2. Open the task list.
  3. Click a specific existing task card.
  4. Do not start or resume the task.
  5. While Codex Desktop is displaying/loading the task content, the JavaScript main-process error dialog appears.

What is the expected behavior?

_No response_

Additional information

_No response_

View original on GitHub ↗

2 Comments

github-actions[bot] contributor · 3 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #23035

Powered by Codex Action

zrt219 · 2 months ago

Adding another reproduction variant for this same main-process crash signature.

Environment

  • Codex Desktop for Windows package path shows OpenAI.Codex_26.608.1337.0_x64__2p2nqsd0c76g0
  • App executable file/product version: 149.0.7827.54
  • OS: Windows 10 Pro 10.0.19045 x64

Crash signature

Dialog shows:

A JavaScript error occurred in the main process
Uncaught Exception:
RangeError: Invalid string length
    at *.write (...)
    at Socket.onStdoutData (...)
    at Socket.emit (node:events:508/509:28)
    at addChunk (node:internal/streams/readable:563:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:514:3)
    at Readable.push (node:internal/streams/readable:394:5)
    at Pipe.onStreamRead (node:internal/stream_base_commons:189:23)

Observed trigger

This was not tied to executing a user command in the terminal. The crash was correlated with Codex Desktop review/status activity on a local Git repo with a very large generated asset change set.

Local Git state at the time:

  • git status --short --untracked-files=all returned 849 changed/untracked paths
  • 846 paths were under one generated asset/content tree
  • extension breakdown: 394 .txt, 339 .png, 70 .json, 26 .md, 17 .py, 3 .pdf
  • the repo had no .gitignore

Relevant sanitized Codex Desktop log pattern:

[git] git.command.complete ... requestKind=review-summary source=review_model subcommand=add argsCount=851 ...
[git] git.command.complete ... requestKind=branch-diff-stats source=review_model subcommand=add argsCount=851 ...
[git] git.command.complete ... requestKind=review-summary source=review_model subcommand=hash-object argsCount=852 ...

The app logs repeatedly showed review_model / branch-diff-stats Git calls with ~850 file arguments immediately before/around the crash. Some Codex desktop logs rotated around ~10 MB while recording these commands, because the serialized command/log payload included hundreds of file paths.

Why this may be a distinct reproduction path

Existing reports discuss oversized session rollouts / inline base64 image data as one way to overflow the main-process stdout string aggregation. This case appears to hit the same Socket.onStdoutData / string-length failure mode through the Desktop review subsystem generating or logging very large Git command payloads for a repo with hundreds of generated assets.

Expected behavior

Codex Desktop should cap/chunk/summarize review-model Git payloads and log records for large worktrees, and should surface a recoverable error if a review summary cannot be generated. It should not crash the Electron main process.

Workaround confirmed

Reducing the Git change set or adding an ignore/tracking policy for generated assets avoids the review flow trying to process hundreds of paths at once.