Windows: closing a Claude Code session triggers uncaught "AttachConsole failed" error in Codex App
What version of the Codex App are you using (From “About Codex” dialog)?
26.527.3686.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?
After opening Claude Code inside the Codex App and then closing it, Codex shows a Windows/Electron error dialog:
A JavaScript error occurred in the main process
Uncaught Exception:
Error: AttachConsole failed
at Object.<anonymous> (C:\Program Files\WindowsApps\OpenAI.Codex_26.527.3686.0_x64__2p2nqsd0c76g0\app\re...:26)
at Module._compile (node:internal/modules/cjs/loader:1820:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1953:10)
at Module.load (node:internal/modules/cjs/loader:1540:32)
at Module._load (node:internal/modules/cjs/loader:1342:12)
at c._load (node:electron/js2c/node_init:2:18082)
at wrapModuleLoad (node:internal/modules/cjs/loader:262:19)
at loadCJSModuleWithModuleLoad (node:internal/modules/esm/translators:334:3)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:235:7)
at ModuleJob.run (node:internal/modules/esm/module_job:430:25)
The app appears to continue running afterward, but the uncaught exception dialog is shown.
A screenshot of the error dialog was provided in the Codex conversation and can be used as visual evidence
What steps can reproduce the bug?
- Open Codex App on Windows.
- Start or open Claude Code from inside Codex.
- Close the Claude Code session/window.
- Observe that Codex shows an Electron main-process JavaScript error dialog with:
Error: AttachConsole failed
Feedback ID:
019e7e34-060c-7a70-ae0f-4214841cee20
What is the expected behavior?
Closing a Claude Code session should not show an uncaught JavaScript error dialog.
If terminal cleanup or process cleanup fails on Windows, Codex should handle the error gracefully and continue without surfacing an Electron main-process exception to the user.
Additional information
Local investigation suggests this may be related to Codex's bundled node-pty Windows ConPTY cleanup path, rather than Claude Code itself.
Evidence observed locally:
- The exact string "AttachConsole failed" exists in Codex's bundled node-pty native module:
C:\Program Files\WindowsApps\OpenAI.Codex_26.527.3686.0_x64__2p2nqsd0c76g0\app\resources\app.asar.unpacked\node_modules\node-pty\build\Release\conpty_console_list.node
- node-pty's Windows cleanup code calls/forks conpty_console_list_agent to fetch console process lists during pty cleanup.
- Codex logs around the incident show:
- shutdown around 2026-05-31 21:18 local time
- external agent import activity for providerId=claude-code shortly after
- no matching Windows Application Event Log crash entry was found in the same time window
There are also repeated plugin cache warnings in Codex logs:
plugin_cache_windows_file_lock / failed to back up plugin cache entry / os error 5
Those warnings may be unrelated, but they were present in the same log file.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗