Codex App shows main-process WebSocket error after Mac wakes from sleep

Resolved 💬 1 comment Opened Jun 13, 2026 by stupidanon Closed Jun 14, 2026

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

26.609.41114

What subscription do you have?

ChatGPT Pro 20x

What platform is your computer?

Darwin 24.6.0 arm64 arm

What issue are you seeing?

The Codex desktop app displayed an Electron/macOS error dialog titled "A JavaScript error occurred in the main process".

This has happened twice now. In both cases, Codex was already open, I put the Mac to sleep by pressing the power button, left it asleep for roughly an hour, then unlocked the Mac. On unlock, this dialog popped up.

The dialog reports an uncaught exception where a WebSocket is terminated before the connection is established.

Transcribed error:

Uncaught Exception:
Error: WebSocket was closed before the connection was established
    at e.terminate (/Applications/Codex.app/Contents/Resources/app.asar/.vite/build/src-fg9h3MDi.js:374:32003)
    at /Applications/Codex.app/Contents/Resources/app.asar/.vite/build/main-DFegGFWC.js:297:1450
    at runNextTicks (node:internal/process/task_queues:65:5)
    at process.processTimers (node:internal/timers:538:9)
    at async X_.runWithSshStartupGate (/Applications/Codex.app/Contents/Resources/app.asar/.vite/build/main-DFegGFWC.js:298:7121)
    at async yI.connectAndWaitForOpen (/Applications/Codex.app/Contents/Resources/app.asar/.vite/build/src-fg9h3MDi.js:368:48509)
    at async yI.startAppServerProcess (/Applications/Codex.app/Contents/Resources/app.asar/.vite/build/src-fg9h3MDi.js:368:46807)

What steps can reproduce the bug?

This has reproduced twice for me with the same sleep/wake pattern:

  1. Open the Codex desktop app and leave it running.
  2. Press the Mac power button to put the computer to sleep.
  3. Leave the Mac asleep for about an hour.
  4. Wake/unlock the Mac.
  5. Observe the JavaScript error dialog from the Codex main process.

I do not know if the exact sleep duration matters; the common factor was that Codex was open before sleep and the error appeared after unlocking later.

I do not have a session id, token limit usage, or context-window usage tied to this crash.

What is the expected behavior?

Codex should survive the macOS sleep/wake cycle without showing an uncaught main-process exception. If the app-server WebSocket closes during sleep or resume, the app should handle it gracefully, reconnect/retry, or show an actionable recoverable error instead of a JavaScript exception dialog.

Additional information

Frequency: observed twice.

Environment from the affected machine:

  • Codex App version: 26.609.41114 (CFBundleVersion 3888)
  • Subscription: ChatGPT Pro 20x
  • macOS: 15.6 (24G84)
  • Platform: Darwin 24.6.0 arm64 arm
  • Install path shown in stack trace: /Applications/Codex.app

The screenshot was used only to transcribe the error above; no image attachment has been uploaded in this draft.

<img width="506" height="323" alt="Image" src="https://github.com/user-attachments/assets/24ba169d-2a36-4a42-931e-35f762397884" />

View original on GitHub ↗

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