codex - 💡(How to fix) Fix Reappearing crash loop - Codex UI became completely unusable

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Uncaught Exception: RangeError: Invalid string length at Ed.write (/Applications/Codex.app/Contents/Resources/app.asar/.vite/build/workspace-root-drop-handler-Bom6Z7sW.js:292:21) at Socket.onStdoutData (/Applications/Codex.app/Contents/Resources/app.asar/.vite/build/workspace-root-drop-handler-Bom6Z7sW.js:292:4146) 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)

Code Example

Uncaught Exception:
RangeError: Invalid string length
at Ed.write (/Applications/Codex.app/Contents/Resources/app.asar/.vite/build/workspace-root-drop-handler-Bom6Z7sW.js:292:21)
at Socket.onStdoutData (/Applications/Codex.app/Contents/Resources/app.asar/.vite/build/workspace-root-drop-handler-Bom6Z7sW.js:292:4146)
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)

---

osascript -e 'quit app "Codex"' 2>/dev/null || true
pkill -f '/Applications/Codex.app' 2>/dev/null || true

REC="$HOME/.codex/recovery-$(date +%Y%m%d-%H%M%S)"
mkdir -p "$REC"

mv "$HOME/Library/Application Support/Codex/Session Storage" "$REC/" 2>/dev/null || true
mv "$HOME/Library/Application Support/Codex/Local Storage" "$REC/" 2>/dev/null || true
mv "$HOME/.codex/.codex-global-state.json" "$REC/" 2>/dev/null || true

open -a Codex

---

osascript -e 'quit app "Codex"' 2>/dev/null || true
pkill -f '/Applications/Codex.app' 2>/dev/null || true

REC="$HOME/.codex/recovery-$(date +%Y%m%d-%H%M%S)"
mkdir -p "$REC/bad-sessions"

find "$HOME/.codex/sessions" -type f -name '*.jsonl' -mtime -7 -size +25M -exec ls -lh {} +

BAD="$(find "$HOME/.codex/sessions" -type f -name '*.jsonl' -mtime -7 -size +25M -print | xargs ls -t 2>/dev/null | head -1)"
echo "Quarantining: $BAD"

if [ -n "$BAD" ]; then
  base="$(basename "$BAD" .jsonl)"
  THREAD_ID="$(printf '%s\n' "$base" | awk -F- '{print $(NF-4)"-"$(NF-3)"-"$(NF-2)"-"$(NF-1)"-"$NF}')"
  mv "$BAD" "$REC/bad-sessions/"
  sqlite3 "$HOME/.codex/state_5.sqlite" "update threads set archived=1, archived_at=strftime('%s','now') where id='$THREAD_ID';"
fi

open -a Codex
RAW_BUFFERClick to expand / collapse

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

I can't even open this due to this bug, but it was latest version as of May 25th, 2026

What subscription do you have?

Pro

What platform is your computer?

Darwin 25.4.0 arm64 arm

What issue are you seeing?

Crash loop showed this:

Uncaught Exception:
RangeError: Invalid string length
at Ed.write (/Applications/Codex.app/Contents/Resources/app.asar/.vite/build/workspace-root-drop-handler-Bom6Z7sW.js:292:21)
at Socket.onStdoutData (/Applications/Codex.app/Contents/Resources/app.asar/.vite/build/workspace-root-drop-handler-Bom6Z7sW.js:292:4146)
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)

It appeared again upon startup. Immediately after clicking OK, it appears again, and the app has become unusable. Restarting the app causes it to appear again. There is no obvious way to get it to disappear. I can't click anything in the Codex UI other than OK, but it reappears immediately.

<img width="1046" height="883" alt="Image" src="https://github.com/user-attachments/assets/f0386f30-4978-4dc8-bc7c-e61664b568c5" />

Codex will also only shut down via Force Quit now.

I also tried to reset session state via the following, but it didn't solve the problem:

osascript -e 'quit app "Codex"' 2>/dev/null || true
pkill -f '/Applications/Codex.app' 2>/dev/null || true

REC="$HOME/.codex/recovery-$(date +%Y%m%d-%H%M%S)"
mkdir -p "$REC"

mv "$HOME/Library/Application Support/Codex/Session Storage" "$REC/" 2>/dev/null || true
mv "$HOME/Library/Application Support/Codex/Local Storage" "$REC/" 2>/dev/null || true
mv "$HOME/.codex/.codex-global-state.json" "$REC/" 2>/dev/null || true

open -a Codex

I was able to clear it by running this script:

osascript -e 'quit app "Codex"' 2>/dev/null || true
pkill -f '/Applications/Codex.app' 2>/dev/null || true

REC="$HOME/.codex/recovery-$(date +%Y%m%d-%H%M%S)"
mkdir -p "$REC/bad-sessions"

find "$HOME/.codex/sessions" -type f -name '*.jsonl' -mtime -7 -size +25M -exec ls -lh {} +

BAD="$(find "$HOME/.codex/sessions" -type f -name '*.jsonl' -mtime -7 -size +25M -print | xargs ls -t 2>/dev/null | head -1)"
echo "Quarantining: $BAD"

if [ -n "$BAD" ]; then
  base="$(basename "$BAD" .jsonl)"
  THREAD_ID="$(printf '%s\n' "$base" | awk -F- '{print $(NF-4)"-"$(NF-3)"-"$(NF-2)"-"$(NF-1)"-"$NF}')"
  mv "$BAD" "$REC/bad-sessions/"
  sqlite3 "$HOME/.codex/state_5.sqlite" "update threads set archived=1, archived_at=strftime('%s','now') where id='$THREAD_ID';"
fi

open -a Codex

What steps can reproduce the bug?

I stopped a thread. It's otherwise not known what caused this.

What is the expected behavior?

Codex should be usable ... or, it should at least be possible to dismiss the error.

Additional information

No response

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Reappearing crash loop - Codex UI became completely unusable