Windows: AttachConsole failed when restarting or closing built-in terminal

Resolved 💬 2 comments Opened Jun 2, 2026 by YuHaiA Closed Jun 2, 2026

Environment

  • OS: Windows
  • Codex Desktop version: 26.527.7698.0 x64
  • Install path shown in stack: C:\Program Files\WindowsApps\OpenAI.Codex_26.527.7698.0_x64__2p2nqsd0c76g0\...
  • Project type: Vue/Vite project
  • Shell: built-in Codex terminal on Windows

Problem

When I restart or close the built-in terminal in Codex Desktop, an Electron main process JavaScript error dialog appears.

This also happens when restarting the built-in terminal, not only while running a project command. External PowerShell/CMD works normally, so this appears to be related to Codex Desktop terminal lifecycle / console attachment on Windows.

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.7698.0_x64__2p2nqsd0c76g0\app\...)
    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
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:334:3)
    at ModuleJob.run (node:internal/modules/esm/module_job:430:25)

Steps to reproduce

  1. Open Codex Desktop on Windows.
  2. Open a project with the built-in terminal.
  3. Close or restart the built-in terminal.
  4. The Electron main process error dialog appears.

Expected behavior

The built-in terminal should close or restart without showing an Electron main process error.

Actual behavior

A JavaScript error dialog appears with AttachConsole failed.

Notes

  • Reproducible when restarting the built-in terminal.
  • Reproducible when closing the built-in terminal.
  • The project dev server is not required to reproduce.
  • External PowerShell/CMD works normally.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗