codex - 💡(How to fix) Fix Codex crashes during a long-running session and closes WezTerm without any error message

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

When the crash happened, Codex exited immediately and the WezTerm terminal window was closed as well. There was no visible error message, panic output, or confirmation prompt before the terminal disappeared, so I was unable to capture any diagnostic output from the terminal. This may be related to handling a large / long-running session, or to how Codex exits when an internal error occurs. Ideally, Codex should preserve the terminal window or print an error message / crash report instead of silently closing the terminal. 9. No error message or diagnostic output is shown before the window closes. Codex should continue running normally, or if an internal error occurs, it should print a clear error message / crash report and keep the terminal available so the output can be inspected. Codex exits unexpectedly during a long-running session, and the WezTerm window closes with no visible error message.

Code Example

{
  "schemaVersion": 1,
  "generatedAt": "1779645644s since unix epoch",
  "overallStatus": "warning",
  "codexVersion": "0.133.0",
  "checks": {
    "app_server.status": {
      "id": "app_server.status",
      "category": "app-server",
      "status": "ok",
      "summary": "background server is not running",
      "details": {
        "control socket": "C:\\Users\\seabiscuit\\.codex\\app-server-control\\app-server-control.sock",
        "daemon state dir": "C:\\Users\\seabiscuit\\.codex\\app-server-daemon",
        "mode": "ephemeral",
        "pid file": "C:\\Users\\seabiscuit\\.codex\\app-server-daemon\\app-server.pid (missing)",
        "settings": "C:\\Users\\seabiscuit\\.codex\\app-server-daemon\\settings.json (missing)",
        "status": "not running",
        "update-loop pid file": "C:\\Users\\seabiscuit\\.codex\\app-server-daemon\\app-server-updater.pid (missing)"
      },
      "remediation": null,
      "durationMs": 0
    },
    "auth.credentials": {
      "id": "auth.credentials",
      "category": "auth",
      "status": "ok",
      "summary": "auth is configured",
      "details": {
        "auth file": "C:\\Users\\seabiscuit\\.codex\\auth.json",
        "auth storage mode": "File",
        "stored API key": "false",
        "stored ChatGPT tokens": "true",
        "stored agent identity": "false",
        "stored auth mode": "chatgpt"
      },
      "remediation": null,
      "durationMs": 0
    },
    "config.load": {
      "id": "config.load",
      "category": "config",
      "status": "ok",
      "summary": "config loaded",
      "details": {
        "CODEX_HOME": "C:\\Users\\seabiscuit\\.codex",
        "config.toml": "C:\\Users\\seabiscuit\\.codex\\config.toml",
        "config.toml parse": "ok",
        "cwd": "D:\\CoreProjects\\BsdCube",
        "enabled feature flags": "shell_tool, shell_snapshot, terminal_resize_reflow, sqlite, memories, hooks, enable_request_compression, multi_agent, apps, tool_suggest, plugins, plugin_hooks, in_app_browser, browser_use, browser_use_external, computer_use, plugin_sharing, image_generation, skill_mcp_dependency_install, steer, guardian_approval, goals, collaboration_modes, tool_call_mcp_elicitation, personality, tui_app_server, workspace_dependencies",
        "feature flag overrides": "memories=true, fast_mode=false",
        "feature flags enabled": "27",
        "log dir": "C:\\Users\\seabiscuit\\.codex\\log",
        "mcp servers": "4",
        "model": "gpt-5.5",
        "model provider": "openai",
        "sqlite home": "C:\\Users\\seabiscuit\\.codex"
      },
      "remediation": null,
      "durationMs": 0
    },
    "installation": {
      "id": "installation",
      "category": "install",
      "status": "ok",
      "summary": "installation looks consistent",
      "details": {
        "PATH codex #1": "D:\\Programs\\Scoop\\shims\\codex.exe",
        "current executable": "D:\\Programs\\Scoop\\apps\\codex\\current\\codex.exe",
        "install context": "other",
        "managed by bun": "false",
        "managed by npm": "false",
        "managed package root": "not set"
      },
      "remediation": null,
      "durationMs": 43
    },
    "mcp.config": {
      "id": "mcp.config",
      "category": "mcp",
      "status": "ok",
      "summary": "MCP configuration is locally consistent",
      "details": {
        "configured servers": "4",
        "disabled servers": "0",
        "stdio servers": "1",
        "streamable_http servers": "3"
      },
      "remediation": null,
      "durationMs": 4708
    },
    "network.env": {
      "id": "network.env",
      "category": "network",
      "status": "ok",
      "summary": "network-related environment looks readable",
      "details": {
        "proxy env vars": "none"
      },
      "remediation": null,
      "durationMs": 0
    },
    "network.provider_reachability": {
      "id": "network.provider_reachability",
      "category": "reachability",
      "status": "ok",
      "summary": "active provider endpoints are reachable over HTTP",
      "details": {
        "ChatGPT base URL": "https://chatgpt.com/backend-api/ reachable (HTTP 403)",
        "reachability mode": "ChatGPT auth"
      },
      "remediation": null,
      "durationMs": 229
    },
    "network.websocket_reachability": {
      "id": "network.websocket_reachability",
      "category": "websocket",
      "status": "warning",
      "summary": "Responses WebSocket timed out; HTTPS fallback may still work",
      "details": {
        "DNS": "1 IPv4, 0 IPv6, first IPv4",
        "auth mode": "chatgpt",
        "connect timeout": "15000 ms",
        "endpoint": "wss://chatgpt.com/backend-api/<redacted>",
        "model provider": "openai",
        "provider name": "OpenAI",
        "proxy env vars": "none",
        "supports websockets": "true",
        "wire API": "responses"
      },
      "notes": [
        "handshake timed out"
      ],
      "remediation": "Check proxy, VPN, firewall, DNS, custom CA, and WebSocket policy support.",
      "durationMs": 15012
    },
    "runtime.provenance": {
      "id": "runtime.provenance",
      "category": "runtime",
      "status": "ok",
      "summary": "running local build on windows-x86_64",
      "details": {
        "commit": "unknown",
        "current executable": "D:\\Programs\\Scoop\\apps\\codex\\current\\codex.exe",
        "install method": "other",
        "platform": "windows-x86_64",
        "version": "0.133.0"
      },
      "remediation": null,
      "durationMs": 0
    },
    "runtime.search": {
      "id": "runtime.search",
      "category": "search",
      "status": "ok",
      "summary": "search is OK (system)",
      "details": {
        "search command": "rg.exe",
        "search command readiness": "ripgrep 15.1.0 (rev af60c2de9d)",
        "search provider": "system"
      },
      "remediation": null,
      "durationMs": 21
    },
    "sandbox.helpers": {
      "id": "sandbox.helpers",
      "category": "sandbox",
      "status": "ok",
      "summary": "sandbox configuration is readable",
      "details": {
        "approval policy": "OnRequest",
        "codex-linux-sandbox helper": "none",
        "execve wrapper helper": "none",
        "filesystem sandbox": "restricted",
        "network sandbox": "enabled"
      },
      "remediation": null,
      "durationMs": 0
    },
    "state.paths": {
      "id": "state.paths",
      "category": "state",
      "status": "ok",
      "summary": "state paths and databases are inspectable",
      "details": {
        "CODEX_HOME": "C:\\Users\\seabiscuit\\.codex (dir)",
        "active rollout files": "19 files, 29354635 total bytes, 1544980 average bytes",
        "archived rollout files": "0 files, 0 total bytes, 0 average bytes",
        "goals DB": "C:\\Users\\seabiscuit\\.codex\\goals_1.sqlite (file)",
        "goals DB integrity": "ok",
        "log DB": "C:\\Users\\seabiscuit\\.codex\\logs_2.sqlite (file)",
        "log DB integrity": "ok",
        "log dir": "C:\\Users\\seabiscuit\\.codex\\log (dir)",
        "sqlite home": "C:\\Users\\seabiscuit\\.codex (dir)",
        "state DB": "C:\\Users\\seabiscuit\\.codex\\state_5.sqlite (file)",
        "state DB integrity": "ok"
      },
      "remediation": null,
      "durationMs": 181
    },
    "terminal.env": {
      "id": "terminal.env",
      "category": "terminal",
      "status": "ok",
      "summary": "terminal metadata was detected",
      "details": {
        "COLORTERM": "truecolor",
        "TERM_PROGRAM": "WezTerm",
        "color output": "enabled",
        "stderr is terminal": "true",
        "stdin is terminal": "true",
        "stdout is terminal": "true",
        "terminal": "WezTerm",
        "terminal size": "167x42",
        "terminal version": "20260331-040028-577474d8"
      },
      "remediation": null,
      "durationMs": 0
    },
    "updates.status": {
      "id": "updates.status",
      "category": "updates",
      "status": "ok",
      "summary": "update configuration is locally consistent",
      "details": {
        "cached latest version": "0.133.0",
        "check for update on startup": "true",
        "last checked at": "2026-05-24T15:54:05.488380500Z",
        "latest version": "0.133.0",
        "latest version status": "current version is not older",
        "update action": "manual or unknown",
        "version cache": "C:\\Users\\seabiscuit\\.codex\\version.json"
      },
      "remediation": null,
      "durationMs": 660
    }
  }
}
RAW_BUFFERClick to expand / collapse

What version of Codex CLI is running?

0.133.0

What subscription do you have?

chat gpt plus

Which model were you using?

gpt-5.5

What platform is your computer?

windows 11

What terminal emulator and version are you using (if applicable)?

wezterm-nightly-20260412

Codex doctor report

{
  "schemaVersion": 1,
  "generatedAt": "1779645644s since unix epoch",
  "overallStatus": "warning",
  "codexVersion": "0.133.0",
  "checks": {
    "app_server.status": {
      "id": "app_server.status",
      "category": "app-server",
      "status": "ok",
      "summary": "background server is not running",
      "details": {
        "control socket": "C:\\Users\\seabiscuit\\.codex\\app-server-control\\app-server-control.sock",
        "daemon state dir": "C:\\Users\\seabiscuit\\.codex\\app-server-daemon",
        "mode": "ephemeral",
        "pid file": "C:\\Users\\seabiscuit\\.codex\\app-server-daemon\\app-server.pid (missing)",
        "settings": "C:\\Users\\seabiscuit\\.codex\\app-server-daemon\\settings.json (missing)",
        "status": "not running",
        "update-loop pid file": "C:\\Users\\seabiscuit\\.codex\\app-server-daemon\\app-server-updater.pid (missing)"
      },
      "remediation": null,
      "durationMs": 0
    },
    "auth.credentials": {
      "id": "auth.credentials",
      "category": "auth",
      "status": "ok",
      "summary": "auth is configured",
      "details": {
        "auth file": "C:\\Users\\seabiscuit\\.codex\\auth.json",
        "auth storage mode": "File",
        "stored API key": "false",
        "stored ChatGPT tokens": "true",
        "stored agent identity": "false",
        "stored auth mode": "chatgpt"
      },
      "remediation": null,
      "durationMs": 0
    },
    "config.load": {
      "id": "config.load",
      "category": "config",
      "status": "ok",
      "summary": "config loaded",
      "details": {
        "CODEX_HOME": "C:\\Users\\seabiscuit\\.codex",
        "config.toml": "C:\\Users\\seabiscuit\\.codex\\config.toml",
        "config.toml parse": "ok",
        "cwd": "D:\\CoreProjects\\BsdCube",
        "enabled feature flags": "shell_tool, shell_snapshot, terminal_resize_reflow, sqlite, memories, hooks, enable_request_compression, multi_agent, apps, tool_suggest, plugins, plugin_hooks, in_app_browser, browser_use, browser_use_external, computer_use, plugin_sharing, image_generation, skill_mcp_dependency_install, steer, guardian_approval, goals, collaboration_modes, tool_call_mcp_elicitation, personality, tui_app_server, workspace_dependencies",
        "feature flag overrides": "memories=true, fast_mode=false",
        "feature flags enabled": "27",
        "log dir": "C:\\Users\\seabiscuit\\.codex\\log",
        "mcp servers": "4",
        "model": "gpt-5.5",
        "model provider": "openai",
        "sqlite home": "C:\\Users\\seabiscuit\\.codex"
      },
      "remediation": null,
      "durationMs": 0
    },
    "installation": {
      "id": "installation",
      "category": "install",
      "status": "ok",
      "summary": "installation looks consistent",
      "details": {
        "PATH codex #1": "D:\\Programs\\Scoop\\shims\\codex.exe",
        "current executable": "D:\\Programs\\Scoop\\apps\\codex\\current\\codex.exe",
        "install context": "other",
        "managed by bun": "false",
        "managed by npm": "false",
        "managed package root": "not set"
      },
      "remediation": null,
      "durationMs": 43
    },
    "mcp.config": {
      "id": "mcp.config",
      "category": "mcp",
      "status": "ok",
      "summary": "MCP configuration is locally consistent",
      "details": {
        "configured servers": "4",
        "disabled servers": "0",
        "stdio servers": "1",
        "streamable_http servers": "3"
      },
      "remediation": null,
      "durationMs": 4708
    },
    "network.env": {
      "id": "network.env",
      "category": "network",
      "status": "ok",
      "summary": "network-related environment looks readable",
      "details": {
        "proxy env vars": "none"
      },
      "remediation": null,
      "durationMs": 0
    },
    "network.provider_reachability": {
      "id": "network.provider_reachability",
      "category": "reachability",
      "status": "ok",
      "summary": "active provider endpoints are reachable over HTTP",
      "details": {
        "ChatGPT base URL": "https://chatgpt.com/backend-api/ reachable (HTTP 403)",
        "reachability mode": "ChatGPT auth"
      },
      "remediation": null,
      "durationMs": 229
    },
    "network.websocket_reachability": {
      "id": "network.websocket_reachability",
      "category": "websocket",
      "status": "warning",
      "summary": "Responses WebSocket timed out; HTTPS fallback may still work",
      "details": {
        "DNS": "1 IPv4, 0 IPv6, first IPv4",
        "auth mode": "chatgpt",
        "connect timeout": "15000 ms",
        "endpoint": "wss://chatgpt.com/backend-api/<redacted>",
        "model provider": "openai",
        "provider name": "OpenAI",
        "proxy env vars": "none",
        "supports websockets": "true",
        "wire API": "responses"
      },
      "notes": [
        "handshake timed out"
      ],
      "remediation": "Check proxy, VPN, firewall, DNS, custom CA, and WebSocket policy support.",
      "durationMs": 15012
    },
    "runtime.provenance": {
      "id": "runtime.provenance",
      "category": "runtime",
      "status": "ok",
      "summary": "running local build on windows-x86_64",
      "details": {
        "commit": "unknown",
        "current executable": "D:\\Programs\\Scoop\\apps\\codex\\current\\codex.exe",
        "install method": "other",
        "platform": "windows-x86_64",
        "version": "0.133.0"
      },
      "remediation": null,
      "durationMs": 0
    },
    "runtime.search": {
      "id": "runtime.search",
      "category": "search",
      "status": "ok",
      "summary": "search is OK (system)",
      "details": {
        "search command": "rg.exe",
        "search command readiness": "ripgrep 15.1.0 (rev af60c2de9d)",
        "search provider": "system"
      },
      "remediation": null,
      "durationMs": 21
    },
    "sandbox.helpers": {
      "id": "sandbox.helpers",
      "category": "sandbox",
      "status": "ok",
      "summary": "sandbox configuration is readable",
      "details": {
        "approval policy": "OnRequest",
        "codex-linux-sandbox helper": "none",
        "execve wrapper helper": "none",
        "filesystem sandbox": "restricted",
        "network sandbox": "enabled"
      },
      "remediation": null,
      "durationMs": 0
    },
    "state.paths": {
      "id": "state.paths",
      "category": "state",
      "status": "ok",
      "summary": "state paths and databases are inspectable",
      "details": {
        "CODEX_HOME": "C:\\Users\\seabiscuit\\.codex (dir)",
        "active rollout files": "19 files, 29354635 total bytes, 1544980 average bytes",
        "archived rollout files": "0 files, 0 total bytes, 0 average bytes",
        "goals DB": "C:\\Users\\seabiscuit\\.codex\\goals_1.sqlite (file)",
        "goals DB integrity": "ok",
        "log DB": "C:\\Users\\seabiscuit\\.codex\\logs_2.sqlite (file)",
        "log DB integrity": "ok",
        "log dir": "C:\\Users\\seabiscuit\\.codex\\log (dir)",
        "sqlite home": "C:\\Users\\seabiscuit\\.codex (dir)",
        "state DB": "C:\\Users\\seabiscuit\\.codex\\state_5.sqlite (file)",
        "state DB integrity": "ok"
      },
      "remediation": null,
      "durationMs": 181
    },
    "terminal.env": {
      "id": "terminal.env",
      "category": "terminal",
      "status": "ok",
      "summary": "terminal metadata was detected",
      "details": {
        "COLORTERM": "truecolor",
        "TERM_PROGRAM": "WezTerm",
        "color output": "enabled",
        "stderr is terminal": "true",
        "stdin is terminal": "true",
        "stdout is terminal": "true",
        "terminal": "WezTerm",
        "terminal size": "167x42",
        "terminal version": "20260331-040028-577474d8"
      },
      "remediation": null,
      "durationMs": 0
    },
    "updates.status": {
      "id": "updates.status",
      "category": "updates",
      "status": "ok",
      "summary": "update configuration is locally consistent",
      "details": {
        "cached latest version": "0.133.0",
        "check for update on startup": "true",
        "last checked at": "2026-05-24T15:54:05.488380500Z",
        "latest version": "0.133.0",
        "latest version status": "current version is not older",
        "update action": "manual or unknown",
        "version cache": "C:\\Users\\seabiscuit\\.codex\\version.json"
      },
      "remediation": null,
      "durationMs": 660
    }
  }
}

What issue are you seeing?

Codex unexpectedly crashed during a long-running session.

The session had already been running for a long time, and the crash happened when I asked another question near the end of the session. After the crash, I checked the Codex session directory and found that this session file was around 7 MB.

When the crash happened, Codex exited immediately and the WezTerm terminal window was closed as well. There was no visible error message, panic output, or confirmation prompt before the terminal disappeared, so I was unable to capture any diagnostic output from the terminal.

This may be related to handling a large / long-running session, or to how Codex exits when an internal error occurs. Ideally, Codex should preserve the terminal window or print an error message / crash report instead of silently closing the terminal.

What steps can reproduce the bug?

Uploaded thread: 019e5963-3b93-7ce3-8a1b-286b6fae3a5c

  1. Open WezTerm.
  2. Start Codex from the terminal.
  3. Use the same Codex session for a long period of time.
  4. Continue asking questions / running tasks until the session becomes relatively large.
  5. In my case, the corresponding Codex session file was around 7 MB.
  6. Ask another question in the existing session.
  7. Codex crashes and exits unexpectedly.
  8. The WezTerm terminal window is closed at the same time.
  9. No error message or diagnostic output is shown before the window closes.

Expected behavior: Codex should continue running normally, or if an internal error occurs, it should print a clear error message / crash report and keep the terminal available so the output can be inspected.

Actual behavior: Codex exits unexpectedly during a long-running session, and the WezTerm window closes with no visible error message.

What is the expected behavior?

No response

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 Codex crashes during a long-running session and closes WezTerm without any error message