codex - 💡(How to fix) Fix Windows: closing a Claude Code session triggers uncaught "AttachConsole failed" error in Codex App

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

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 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 4. Observe that Codex shows an Electron main-process JavaScript error dialog with: Error: AttachConsole failed 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. plugin_cache_windows_file_lock / failed to back up plugin cache entry / os error 5

RAW_BUFFERClick to expand / collapse

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?

  1. Open Codex App on Windows.
  2. Start or open Claude Code from inside Codex.
  3. Close the Claude Code session/window.
  4. 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.

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 Windows: closing a Claude Code session triggers uncaught "AttachConsole failed" error in Codex App