Codex crashes when CWD is unlinked
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 52/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- rust
- Domain
- cli, operating-systems
Research direction
Reproduce the crash by starting Codex in /tmp/gone, removing that directory, and observing the "turn/start failed in TUI" path and Rust stack trace. Trace the turn/start handling from that entry point and make the unlinked original CWD case complete without crashing, then rerun the reproduction.
Written by the indexing model from the issue text.
Description
What version of Codex CLI is running?
codex-cli 0.145.0
What subscription do you have?
Enterprise
Which model were you using?
gpt-5.6-sol
What platform is your computer?
Linux 6.16.1 x86_64
What terminal emulator and version are you using (if applicable)?
tmux
Codex doctor report
{
"schemaVersion": 1,
"generatedAt": "<redacted-timestamp>",
"overallStatus": "fail",
"codexVersion": "0.145.0",
"checks": {
"app_server.status": {
"id": "app_server.status",
"category": "app-server",
"status": "ok",
"summary": "background server is not running",
"details": {
"control socket": "<codex-home>/app-server-control/app-server-control.sock",
"daemon state dir": "<codex-home>/app-server-daemon",
"mode": "ephemeral",
"pid file": "<codex-home>/app-server-daemon/app-server.pid (missing)",
"settings": "<codex-home>/app-server-daemon/settings.json (missing)",
"status": "not running",
"update-loop pid file": "<codex-home>/app-server-daemon/app-server-updater.pid (missing)"
},
"remediation": null,
"durationMs": 0
},
"auth.credentials": {
"id": "auth.credentials",
"category": "auth",
"status": "ok",
"summary": "auth is provided by the active model provider",
"details": {
"auth env vars present": "<auth-env-var>",
"auth file": "<codex-home>/auth.json",
"auth storage mode": "File",
"model provider requires OpenAI auth": "false",
"provider auth env var": "<auth-env-var> (present)"
},
"remediation": null,
"durationMs": 0
},
"config.load": {
"id": "config.load",
"category": "config",
"status": "ok",
"summary": "config loaded",
"details": {
"CODEX_HOME": "<codex-home>",
"config.toml": "<codex-home>/config.toml",
"config.toml parse": "ok",
"cwd": "/home/<user>",
"enabled feature flags": "<redacted feature list>",
"feature flag overrides": "<redacted overrides>",
"feature flags enabled": "33",
"log dir": "<codex-home>/log",
"mcp servers": "1",
"model": "<configured model>",
"model provider": "responses",
"sqlite home": "<codex-home>"
},
"remediation": null,
"durationMs": 0
},
"git.environment": {
"id": "git.environment",
"category": "git",
"status": "ok",
"summary": "git version 2.52.0",
"details": {
"PATH git #1": "<git-bin>",
"PATH git #2": "<git-bin>",
"PATH git entries": "2",
"git build options": "git version 2.52.0; cpu: x86_64; no commit associated with this build; sizeof-long: 8; sizeof-size_t: 8; shell-path: /bin/sh; rust: disabled; libcurl: 7.76.1; OpenSSL: OpenSSL 3.5.1 1 Jul 2025; zlib: 1.2.11; SHA-1: SHA1_DC; SHA-256: SHA256_BLK; default-ref-format: files; default-hash: sha1",
"git exec path": "<git-exec-path>",
"git version": "git version 2.52.0",
"repo detected": "false",
"selected git": "<git-bin>"
},
"remediation": null,
"durationMs": 11
},
"installation": {
"id": "installation",
"category": "install",
"status": "ok",
"summary": "installation looks consistent",
"details": {
"PATH codex #1": "<codex-bin>",
"PATH codex #2": "<codex-bin>",
"PATH codex entries": "2",
"current executable": "<codex-executable>",
"install context": "other",
"managed by bun": "false",
"managed by npm": "false",
"managed by pnpm": "false",
"managed package root": "not set"
},
"remediation": null,
"durationMs": 0
},
"mcp.config": {
"id": "mcp.config",
"category": "mcp",
"status": "ok",
"summary": "MCP configuration is locally consistent",
"details": {
"configured servers": "1",
"disabled servers": "0",
"stdio servers": "1"
},
"remediation": null,
"durationMs": 0
},
"network.env": {
"id": "network.env",
"category": "network",
"status": "ok",
"summary": "network-related environment looks readable",
"details": {
"proxy env vars present": "<proxy env vars present>"
},
"remediation": null,
"durationMs": 0
},
"network.provider_reachability": {
"id": "network.provider_reachability",
"category": "reachability",
"status": "fail",
"summary": "one or more required provider endpoints are unreachable over HTTP",
"details": {
"reachability mode": "provider auth",
"responses API base URL": "https://<redacted-internal-host>/openai/<redacted> error sending request for url (https://<redacted-internal-host>/openai/<redacted>) (required)"
},
"remediation": "Check proxy, VPN, firewall, DNS, and custom CA configuration.",
"durationMs": 137
},
"network.websocket_reachability": {
"id": "network.websocket_reachability",
"category": "websocket",
"status": "ok",
"summary": "Responses WebSocket is not enabled for the active provider",
"details": {
"model provider": "responses",
"provider name": "Azure",
"proxy env vars present": "<proxy env vars present>",
"supports websockets": "false",
"wire API": "responses"
},
"remediation": null,
"durationMs": 0
},
"runtime.provenance": {
"id": "runtime.provenance",
"category": "runtime",
"status": "ok",
"summary": "running local build on linux-x86_64",
"details": {
"commit": "unknown",
"current executable": "<codex-executable>",
"install method": "other",
"platform": "linux-x86_64",
"version": "0.145.0"
},
"remediation": null,
"durationMs": 0
},
"runtime.search": {
"id": "runtime.search",
"category": "search",
"status": "ok",
"summary": "search is OK (system)",
"details": {
"search command": "rg",
"search command readiness": "ripgrep 14.1.1",
"search provider": "system"
},
"remediation": null,
"durationMs": 1
},
"sandbox.helpers": {
"id": "sandbox.helpers",
"category": "sandbox",
"status": "ok",
"summary": "sandbox configuration is readable",
"details": {
"approval policy": "UnlessTrusted",
"codex-linux-sandbox helper": "<codex-home>/tmp/arg0/codex-arg07beq49/codex-linux-sandbox",
"execve wrapper helper": "<codex-home>/tmp/arg0/codex-arg07beq49/codex-execve-wrapper",
"filesystem sandbox": "unrestricted",
"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": "<codex-home> (dir)",
"active rollout files": "64 files, 58768622 total bytes, 918259 average bytes",
"archived rollout files": "0 files, 0 total bytes, 0 average bytes",
"goals DB": "<codex-home>/goals_1.sqlite (file)",
"goals DB integrity": "ok",
"log DB": "<codex-home>/logs_2.sqlite (file)",
"log DB integrity": "ok",
"log dir": "<codex-home>/log (missing)",
"memories DB": "<codex-home>/memories_1.sqlite (file)",
"memories DB integrity": "ok",
"sqlite home": "<codex-home> (dir)",
"state DB": "<codex-home>/state_5.sqlite (file)",
"state DB integrity": "ok",
"thread history DB": "<codex-home>/thread_history_1.sqlite (missing)",
"thread history DB integrity": "skipped (missing)"
},
"remediation": null,
"durationMs": 164
},
"state.rollout_db_parity": {
"id": "state.rollout_db_parity",
"category": "threads",
"status": "ok",
"summary": "rollout files and state DB thread inventory agree",
"details": {
"default model provider": "responses",
"rollout DB active files": "64",
"rollout DB active rows": "64",
"rollout DB archive mismatches": "0",
"rollout DB archived files": "0",
"rollout DB archived rows": "0",
"rollout DB duplicate DB paths": "0",
"rollout DB duplicate rollout thread ids": "0",
"rollout DB malformed file names": "0",
"rollout DB missing active rows": "0",
"rollout DB missing archived rows": "0",
"rollout DB model providers": "responses=64",
"rollout DB rows": "64",
"rollout DB scan cap reached": "false",
"rollout DB scan errors": "0",
"rollout DB sources": "cli=41, subagent:thread_spawn=22, subagent:other=1",
"rollout DB stale rows": "0"
},
"remediation": null,
"durationMs": 25
},
"system.environment": {
"id": "system.environment",
"category": "system",
"status": "ok",
"summary": "OS language C",
"details": {
"EDITOR": "set",
"GH_PAGER": "set",
"GIT_PAGER": "set",
"LANG": "en_US.UTF-8",
"LC_ALL": "C.UTF-8",
"LC_CTYPE": "C.UTF-8",
"LESS": "set",
"PAGER": "set",
"VISUAL": "not set",
"os": "CentOS 9.0.0 [64-bit]",
"os language": "C",
"os type": "CentOS",
"os version": "9.0.0"
},
"remediation": null,
"durationMs": 1
},
"terminal.env": {
"id": "terminal.env",
"category": "terminal",
"status": "ok",
"summary": "terminal metadata was detected",
"details": {
"COLORTERM": "present",
"NO_COLOR": "1",
"SSH_CLIENT": "present",
"SSH_CONNECTION": "present",
"TERM": "xterm-256color",
"color output": "disabled (NO_COLOR)",
"effective locale": "C.UTF-8",
"multiplexer": "tmux 3.5a",
"stderr is terminal": "false",
"stdin is terminal": "false",
"stdout is terminal": "false",
"terminal": "unknown",
"terminal size": "80x24",
"tmux allow-passthrough": "off",
"tmux client termname": "xterm-256color",
"tmux extended-keys": "off",
"tmux focus-events": "off",
"tmux set-clipboard": "external",
"tmux xterm-keys": "on"
},
"remediation": null,
"durationMs": 31
},
"terminal.title": {
"id": "terminal.title",
"category": "title",
"status": "ok",
"summary": "terminal title default",
"details": {
"terminal title activity": "true",
"terminal title items": "activity, project-name",
"terminal title project source": "project config",
"terminal title project value": "<project-name>",
"terminal title source": "default"
},
"remediation": null,
"durationMs": 0
},
"updates.status": {
"id": "updates.status",
"category": "updates",
"status": "warning",
"summary": "update configuration is locally consistent",
"details": {
"check for update on startup": "false",
"latest version probe": "curl: (6) Could not resolve host: api.github.com",
"update action": "manual or unknown",
"version cache": [
"<codex-home>/version.json",
"missing"
]
},
"remediation": null,
"durationMs": 8
}
}
}
What issue are you seeing?
Codex crashes with an error message "Error: turn/start failed in TUI" followed by a Rust stack trace when the original CWD where Codex started up is unlinked.
What steps can reproduce the bug?
Reproducing the issue by explicitly rm -rf-ing the original cwd:
$ mkdir -p /tmp/gone
$ cd /tmp/gone
$ codex
╭─────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.145.0) │
│ │
│ model: gpt-5.6-sol xhigh /model to change │
│ directory: /tmp/gone │
╰─────────────────────────────────────────────────╯
Tip: Use /personality to customize how Codex communicates.
• You ran rm -rf /tmp/gone
└ (no output)
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
› hello
Error: turn/start failed in TUI
Stack backtrace:
0: <unknown>
1: <unknown>
2: <unknown>
3: <unknown>
4: <unknown>
5: <unknown>
6: <unknown>
7: <unknown>
8: start_thread
at /..redacted../glibc/2.34/src/glibc-2.34/nptl/pthread_create.c:434:8
9: clone3
at /..redacted../glibc/2.34/src/glibc-2.34/misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81:0
The issue is reported more commonly in our environment when the original cwd disappears while moving around the commits
[~/repo]$ mkdir gone
[~/repo]$ touch gone/f
[~/repo]$ hg commit -A -m "do not land"
adding gone/f
[~/repo]$ cd gone
[~/repo/gone]$ codex
╭─────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.145.0) │
│ │
│ model: gpt-5.6-sol xhigh /model to change │
│ directory: /data/users/shou/fbsource/gone │
╰─────────────────────────────────────────────────╯
Tip: NEW: Prevent sleep while running is now available in /experimental.
• You ran hg up -r .^
└ update complete
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
› hey
Error: turn/start failed in TUI
Stack backtrace:
0: <unknown>
1: <unknown>
2: <unknown>
3: <unknown>
4: <unknown>
5: <unknown>
6: <unknown>
7: <unknown>
8: start_thread
at /..redacted../glibc/2.34/src/glibc-2.34/nptl/pthread_create.c:434:8
9: clone3
at /..redacted../glibc/2.34/src/glibc-2.34/misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81:0
What is the expected behavior?
Codex keeps going the session without crash by changing directory to some default or closest parent. Otherwise, Codex shows a clearer error message before crashing.
Additional information
No response
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.5k
- Avg merge
- 1m
- Merged PRs (30d)
- 1k
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from openai/codex
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
bug CLI windows-os
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
macOS sandbox blocks hw.optional.arm64 sysctl, causing Flutter to misdetect Apple Silicon as x64 Openbug CLI sandbox
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug CLI TUI
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
CLI config enhancement skills
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
A-linter
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
oxc-project/oxc#26863 ·