Codex Troubleshooting skill for Codex
From cryptic Codex error to named root cause. Codex follows a fixed triage order (version, codex doctor, login status, /debug-config, strict config, debug logs), classifies the failure as config, auth, model, sandbox, network, MCP, discovery or performance, reproduces it minimally, and applies the narrowest fix at the right layer instead of widening permissions until the error goes away.
curl -fsSL codexskills.dev/install.sh \ | sh -s -- codex-troubleshooting Installs to ~/.agents/skills/codex-troubleshooting/ for every project on this machine.
curl -fsSL codexskills.dev/cli.mjs -o codex-skills.mjsnode codex-skills.mjs install codex-troubleshooting The CLI also searches, updates and removes skills. Run it with no arguments to pick from a list. Needs Node 20.12+.
curl -fsSL codexskills.dev/install.sh \ | sh -s -- --project codex-troubleshooting Installs to .agents/skills/codex-troubleshooting/ in the current repository. Commit it and everyone who runs Codex there gets it.
curl -fsSLO codexskills.dev/downloads/codex-troubleshooting.zipunzip -o codex-troubleshooting.zip -d ~/.agents/skills/ The archive holds the skill folder with its generated agents/openai.yaml. Unzip into .agents/skills/ to scope it to a repo.
& ([scriptblock]::Create((irm codexskills.dev/install.ps1))) codex-troubleshooting PowerShell 5.1 or 7. Installs to %USERPROFILE%\.agents\skills\. Add -Project for the current repo.
104-line POSIX script. No sudo, no telemetry. Read install.sh
Use it in Codex
Start a prompt with $codex-troubleshooting, or pick it from /skills.
You can also just describe the task: Codex reads the description below and loads the playbook when your request matches.
What Codex reads before loading it
Diagnoses and fixes Codex CLI, IDE and app problems with a fixed triage order (codex doctor, codex login status, /status, /debug-config, --strict-config, RUST_LOG and log_dir logs) covering start-up and config errors, retired settings, sign-in and TLS failures, unknown models, sandbox denials, MCP servers that time out or show no tools, missing skills, AGENTS.md or hooks, and slow or stuck runs. Use when Codex errors, refuses to start, cannot authenticate, keeps getting denied, an MCP server fails, or a run hangs or crawls.
Use it when
- Codex fails to start, errors on config, or ignores settings
- Sign-in, certificate or keyring problems
- Commands are repeatedly denied by the sandbox
- MCP servers fail, time out or expose no tools
- Runs hang, crawl or behave differently between CLI and app
Use something else when
- You want to lock down a working setup rather than fix a broken one: use codex-security-hardening
- Building or debugging your own MCP server code: use mcp-server-builder
How to check the result
The original failing action succeeds, codex doctor shows no warn or fail rows for the affected area, and the fix is recorded with its cause.
The mistake it prevents
Silencing sandbox denials by switching to danger-full-access on the host instead of granting the one path or domain the task needed.
A Codex problem is fixed when the root cause is named (config layer, auth, sandbox, network, server, version), the change that fixed it is minimal and recorded, and the original failing action now succeeds. Widening permissions until the error disappears is not a fix.
Triage order
Run these before changing anything; most issues show up in the first three.
codex --version # many fixes depend on version; compare with docs
codex doctor --summary # install, config, auth, MCP, sandbox, connectivity
codex doctor # details for any warn/fail rows (--json for a redacted report)
codex login status # which auth method is active
codex exec --strict-config "say ok" # fails with file:line on config keys this version does not know
Inside a session:
| Command | Shows |
|---|---|
/status | Model, approval policy, writable roots, context and limit usage |
/debug-config | Config layers in order, on/off state, requirements and their sources |
/mcp verbose | MCP servers, status and tools |
/hooks | Hooks, trust state |
/warnings | Warnings shown earlier in the session |
/ps | Background terminals and recent output |
Logs:
RUST_LOG=debug codex -c log_dir=./.codex-log # plaintext TUI log
tail -F ./.codex-log/codex-tui.log
RUST_LOG=info codex exec "..." # exec logs inline (default level is error)
codex login writes codex-login.log in the log directory. Desktop app logs on macOS:
~/Library/Logs/com.openai.codex/YYYY/MM/DD. Session transcripts:
~/.codex/sessions/. Review logs for secrets before sharing them.
Symptom map
| Symptom | First suspect | Fix |
|---|---|---|
| Codex will not start after an update | Retired setting such as approval_policy = "untrusted" | Remove it; use [projects."<path>"] trust_level = "untrusted" for strict approvals |
--profile x ignores settings | Profile still in [profiles.x] in config.toml (unsupported since 0.134.0) | Move to ~/.codex/x.config.toml with top-level keys; delete profile = ... selector |
| Setting has no effect | Overridden by a higher layer, or project untrusted | /debug-config; check CLI flags, project .codex/config.toml, requirements |
| Startup warning about ignored project keys | Provider, base URL, notify, otel or profile keys in project config | Move them to ~/.codex/config.toml |
| Unknown or unavailable model | Retired id or not on your plan | /model or codex debug models; replace the id everywhere |
| Custom provider rejected | wire_api = "chat" or Chat Completions-only endpoint | Use a Responses API-compatible endpoint |
| Browser login cannot complete on a server | No local browser | codex login --device-auth, or ssh -L 1455:localhost:1455, or copy auth.json |
| TLS or certificate errors behind a proxy | Corporate TLS interception | export CODEX_CA_CERTIFICATE=/path/corp-root.pem |
| Keyring errors at login | No OS credential store (containers, minimal Linux) | cli_auth_credentials_store = "file" (protect auth.json) or "auto" |
| Billed to API instead of plan | CODEX_API_KEY or API-key login active | codex login status; unset the variable |
| Command denied: write outside workspace | Sandbox boundary | Add the path with --add-dir, or do it yourself; do not jump to full access |
git commit needs approval | .git is read-only in workspace-write | Expected; approve, or commit yourself |
npm install/curl fails offline | Network off by default | -c sandbox_workspace_write.network_access=true for that run, ideally with the network proxy allowlist |
| Linux sandbox errors in Docker | Container blocks namespaces, setuid bwrap or seccomp | Grant the capabilities, or make the container the boundary and use --sandbox danger-full-access inside it |
| MCP server “timed out” at start | Cold npx/uvx download over 10 s default | startup_timeout_sec = 60; pre-install the package |
| MCP tool calls time out | Slow tool over 60 s default | tool_timeout_sec for that server |
| MCP server starts but shows no tools | enabled_tools/disabled_tools filter, crash on init, or logs written to stdout | /mcp verbose; run the server command by hand; servers must log to stderr |
| MCP server missing its token | Env not forwarded to stdio servers | env_vars = ["TOKEN_NAME"] or env = { ... } |
codex exec exits on MCP failure | Server marked required = true | Fix the server, or drop required for optional ones |
| Skill not offered | Wrong location, name mismatch, disabled in [[skills.config]], catalog budget warning | Check .agents/skills/<name>/SKILL.md; restart Codex |
| AGENTS.md rules ignored | Different CODEX_HOME, empty file, an AGENTS.override.md shadowing it, size cap | Ask Codex to list loaded instruction files; check project_doc_max_bytes |
| Hooks never fire | Not trusted yet, project untrusted, matcher uses a tool name Codex does not emit | /hooks to trust; matchers Bash, apply_patch or `Edit |
| Run looks frozen | Waiting for an approval, or a long background command | Check the approval prompt; /ps, /stop |
| Runs are slow | High effort, huge context, many MCP servers, slow tests in loop | Lower effort, trim context, scope tests; /fast if available and worth the usage |
| Works in CLI, not in the desktop app | Different bundled Codex versions | Compare codex --version with the app’s bundled binary version |
For detailed steps per category (config layers, auth, sandbox, MCP, performance), read references/symptoms.md when the table’s fix does not resolve the issue.
Workflow
- [ ] 1. Capture the exact error text, command, and codex --version
- [ ] 2. Run the triage commands; note any warn/fail rows
- [ ] 3. Classify: config | auth | model | sandbox | network | MCP | discovery | performance
- [ ] 4. Reproduce minimally (codex exec with one prompt, or the raw command under codex sandbox)
- [ ] 5. Apply the narrowest fix at the right layer
- [ ] 6. Re-run the original action and the triage command that flagged it
- [ ] 7. Record cause and fix
Minimal reproduction helpers:
codex exec --ignore-user-config --sandbox read-only "say hi" # is user config the cause?
codex exec -c mcp_servers.github.enabled=false "say hi" # is one MCP server the cause?
codex mcp list # configured servers
codex features list # effective feature flags
Hard rules
- Never fix a sandbox denial by switching to
danger-full-accessor--yoloon a host machine. Grant the specific path or network access the task needs. - Never paste
auth.json, tokens or full session logs into issues or chats. - Change one thing at a time and re-run the failing action after each change.
- When docs and
codex --helpdisagree, trust the installed version’s--help, and considercodex update.
Escalate
If still broken: /feedback in the session (attach the session if appropriate and keep
the returned session id), and search or open an issue at github.com/openai/codex/issues
with version, OS, the doctor summary and the minimal reproduction.
Output template
**Symptom:** `codex exec` exits with "MCP server sentry failed to start".
**Version / OS:** codex-cli 0.165.0, Ubuntu 24.04 (CI runner)
**Cause:** Server marked `required = true`; `npx` cold download took 18 s > 10 s default.
**Fix:** `startup_timeout_sec = 45` and pre-install step in CI (project .codex/config.toml).
**Verified:** codex doctor mcp row ok; original job green twice. What the zip contains
Codex reads bundled files only when a step points to them. Every one is shown here, so you can review it before installing.
agents/openai.yaml
Gives the Codex app a display name, a one-line description and a starter prompt for this skill.
interface:
display_name: "Codex Troubleshooting"
short_description: "From cryptic Codex error to named root cause"
default_prompt: "$codex-troubleshooting Codex won't start after I updated it, here's the error" references/symptoms.md
# Detailed fixes by category
Read only the section that matches the classification from the main workflow.
## Config and layers
Resolution order, highest first: CLI flags and `-c` overrides; project
`.codex/config.toml` files from root to working directory (trusted projects only);
the profile file chosen with `--profile` (`~/.codex/<name>.config.toml`); user
`~/.codex/config.toml`; cloud-managed defaults; `/etc/codex/config.toml`; built-in
defaults. Admin requirements (`requirements.toml`, Agent Security, MDM) then constrain
the result and fall back to a compatible value with a notice.
Steps:
1. `/debug-config` and read the layer list bottom to top.
2. `codex exec --strict-config "say ok"` (or start the TUI with `--strict-config`) to
get a file:line error for keys the installed version does not know (typos, keys
from newer docs, removed keys). `codex doctor` does not flag unknown keys.
3. Check for `CODEX_HOME`: `echo $CODEX_HOME`. A non-default value means a different
config, auth and sessions directory than the one you edited.
4. `-c` values are TOML: strings need inner quotes, e.g. `-c model='"gpt-6.1-sol"'`;
unparseable values become literal strings, which can silently set the wrong type.
5. Legacy items to remove: `approval_policy = "untrusted"`, `[profiles.<name>]` tables
and `profile = "<name>"` (since 0.134.0), `--full-auto` in scripts (use
`--sandbox workspace-write` or `--approve-for-me`), `wire_api = "chat"`,
`personality = "friendly"|"pragmatic"` (no longer selects a style).
6. Permission profiles and `sandbox_mode` do not compose: if any loaded layer sets
`sandbox_mode` (or you pass `--sandbox`), `default_permissions` is ignored unless
managed `allowed_permission_profiles` forces profiles.
## Authentication
- `codex login status` shows the active method. Workload-identity processes reject
`codex login`/`codex logout` because the environment controls auth.
- Device code login (`codex login --device-auth`) must be enabled in ChatGPT security
settings (personal) or workspace permissions (admin).
- Port forwarding fallback: the login callback listens on `localhost:1455`.
- Copying `~/.codex/auth.json` works only with file storage; with keyring storage the
file may not exist.
- `forced_login_method` and `forced_chatgpt_workspace_id` can block a login that looks
correct; check managed config.
- Corporate proxies: `CODEX_CA_CERTIFICATE` (takes precedence) or `SSL_CERT_FILE`
pointing to a PEM bundle.
- MFA is required before Codex access if the account has email and password login.
## Models
- `codex debug models` renders the catalog the installed CLI uses; `/model` shows what
the account can use.
- Some models require a minimum CLI version (GPT-6.1 Terra needs 0.159.0+).
- After a retirement, search every place a model id can hide:
`rg -n 'model\s*=|--model|-m ' ~/.codex .codex .github scripts`.
- Custom agents (`.codex/agents/*.toml`) and scheduled tasks can pin models too.
## Sandbox and approvals
- Reproduce outside the agent: `codex sandbox <command>` (newer releases:
`codex sandbox macos|linux|windows [--log-denials] <command>`); check
`codex sandbox --help`.
- Writable roots: current workspace plus temp dirs; `--add-dir <dir>` adds more;
`/status` lists them.
- Protected even when writable: `.git` (including a worktree's resolved git dir),
`.agents`, `.codex`, `.aws`.
- macOS may prompt for access to Desktop, Documents, Downloads, Music: approve in the
system dialog or keep work out of those folders.
- WSL1 is unsupported since 0.115 (Linux sandbox moved to `bwrap`); use WSL2.
- Windows: prefer MXC (`[features] prefer_mxc = true`) with `windows.sandbox =
"elevated"` as fallback; `/setup-default-sandbox` sets up the elevated sandbox.
- "Approve for me" missing: check for `features.guardian_approval = false`, the
approval policy and reviewer, and admin allowlists.
- With `-a never`, failures go straight back to the model; nothing is asked. Expect
more failed commands, not escalations.
## Network
- Default: command network off in `workspace-write`.
- `sandbox_workspace_write.network_access = true` enables it; with
`features.network_proxy` enabled, only allowlisted domains work.
- Domain rules alone do nothing without the proxy; the proxy alone does nothing when
network access is off.
- Hostnames resolving to private IPs stay blocked unless explicitly allowed
(`allow_local_binding = false` default). Local dev servers need an exact `localhost`
or IP allow rule.
- Web search, MCP connections and model traffic do not go through the command proxy.
- When a managed environment allows a domain but it is still blocked, a
higher-priority policy wins; compare effective policies rather than widening the
global baseline.
## MCP servers
Checklist:
1. `codex mcp list`, then `codex mcp get <name>` for its effective config.
2. Run the exact `command` and `args` by hand in a terminal; it should wait silently on
stdin. Anything printed to stdout that is not protocol JSON breaks the connection.
3. Timeouts: `startup_timeout_sec` (default 10), `tool_timeout_sec` (default 60);
`mcp_optional_startup_grace_ms` (default 1000) is how long the initial tool catalog
waits for optional servers.
4. Environment: stdio servers get `env` values and the variables named in `env_vars`.
5. HTTP servers: `bearer_token_env_var`, `http_headers`, `env_http_headers`, or OAuth
via `codex mcp login <name>` (`--scopes` if needed).
6. Admin `mcp_servers` allowlists disable servers whose name and identity do not match.
7. Tool filters: `enabled_tools` then `disabled_tools`.
8. Too many tools or servers degrade tool choice and cost tokens; disable what the task
does not need.
## Discovery: AGENTS.md, skills, hooks
- AGENTS.md: per directory, `AGENTS.override.md` beats `AGENTS.md` beats fallback
names; empty files are skipped; chain capped by `project_doc_max_bytes` (32 KiB).
Restart to pick up edits.
- Project root defaults to the nearest `.git`; `project_root_markers` changes it.
- Skills: `.agents/skills` from the working directory up to the repo root,
`~/.agents/skills`, `/etc/codex/skills`, bundled. Folder name and `name:` should
match. Disabled entries in `[[skills.config]]` hide a skill. If many skills are
installed, descriptions are shortened and some may be omitted with a warning
(`skills.max_context_tokens`, max 10000).
- Hooks: `features.hooks` must be on (default true); new or changed hooks need trust
in `/hooks`; project hooks need a trusted project; `SessionStart` hooks can run
before MCP servers are ready.
## Performance
| Cause | Check | Fix |
|---|---|---|
| High reasoning effort | `/status` | Lower effort for routine work |
| Huge context | `/status`, `codex debug prompt-input` size | Trim AGENTS.md, MCP servers, skills; `/compact` |
| Slow MCP start | doctor `mcp` row, logs | Pre-install packages, lower server count |
| Test loops | transcript | Ask for targeted tests first, full suite at the end |
| Background commands | `/ps` | `/stop` stuck terminals |
| Provider streaming stalls (custom provider) | logs | `stream_idle_timeout_ms`, `stream_max_retries` on the provider |
| Out-of-date CLI | `codex doctor` update note | `codex update` |
About this skill
Written and maintained by the Codex Skills editors to the same editorial standard as every skill here: a selective description, a real workflow, known pitfalls and a way to verify the work. First published , last updated . MIT licensed. Something wrong or out of date? Tell us.