Common Codex errors and fixes

Search an error message, code or keyword to find causes and steps to fix it.

19 common errors

Model at capacity

Service
Selected model is at capacity.
codex_error_info: server_overloaded

The model service cannot handle the request at the moment. This differs from Usage Limit and does not establish that your quota is exhausted.

How to fix it
  1. Save task progress, switch to an available model or retry later, and check OpenAI service status.
  2. If only the old thread fails, start a new one with a handoff. If all models keep failing, submit the time, version and error type via /feedback.

Switch models inside Codex CLI

/model
OpenAI service status

Quota or account entitlement

Account & quota
You've hit your usage limit. UsageLimitExceeded

The request is limited by quota or account entitlement. Verify the sign-in method, account and usage window.

How to fix it
  1. Check the active account, workspace, and 5-hour/weekly reset times on the usage page.
  2. If quota still appears available, save progress and sign in again to the correct account. If the mismatch persists, keep a redacted screenshot and timestamp.

API keys use OpenAI Platform billing and limits, not the Codex allowance in a ChatGPT plan. Custom providers may have their own rules.

Check sign-in status

codex login status

Re-authenticate an expired ChatGPT sign-in

codex logout
codex login

This signs you out; save your task first. API key users should check the key and endpoint first.

OAuth falls back to dummy

Authentication
401 Unauthorized: Incorrect API key provided: dummy

For ChatGPT sign-in, this matches a reported OAuth state issue, especially after changing networks.

How to fix it
  1. Confirm the sign-in method. ChatGPT users should re-authenticate first; dummy alone is no reason to create an API key.
  2. For a custom provider or API key, inspect provider authentication; dummy may also be a local placeholder.

Check sign-in status

codex login status

Re-authenticate an expired ChatGPT sign-in

codex logout
codex login

This signs you out; save your task first. API key users should check the key and endpoint first.

Authentication failed · 401

Authentication
401 Unauthorized

Credentials may have expired, the account may be wrong, or the request may target the wrong provider.

How to fix it
  1. Check sign-in status and the target provider. Confirm whether you use ChatGPT sign-in or an API key.
  2. ChatGPT users can save progress, sign out and sign in again. API key users should check key status, organization and endpoint.

API keys use OpenAI Platform billing and limits, not the Codex allowance in a ChatGPT plan. Custom providers may have their own rules.

Check sign-in status

codex login status

Re-authenticate an expired ChatGPT sign-in

codex logout
codex login

This signs you out; save your task first. API key users should check the key and endpoint first.

Reconnecting or stream interrupted

Network & transport
Reconnecting... 1/5
stream disconnected before completion

Network, proxy, client or service issues can interrupt a connection. Reconnecting alone does not identify the cause.

How to fix it
  1. Run Doctor; check VPN, proxy, DNS, firewall and custom CAs. Compare using a phone hotspot.
  2. Compare CLI and Desktop with the same account and network. If both fail, check service status and custom providers.

Check connectivity and installation

codex doctor --summary

Requires Codex CLI. If an older version lacks Doctor, check codex --help first.

OpenAI service status

WebSocket timeout

Network & transport
Responses WebSocket timed out

The WSS handshake or transfer did not complete. Check WebSocket policies and the network path.

How to fix it
  1. Run Doctor and compare another network. Confirm that the proxy or firewall allows WSS.
  2. If only this network fails, inspect DNS, certificates and IPv4/IPv6 routing. Permanently disabling IPv6 is not the default fix.

Check connectivity and installation

codex doctor --summary

Requires Codex CLI. If an older version lacks Doctor, check codex --help first.

OpenAI service status

Custom endpoint or local proxy

Client & configuration
Connection refused: http://127.0.0.1:8787/v1
openai_base_url

Codex may still be using an old endpoint override, or the local proxy may not be running.

How to fix it
  1. Inspect openai_base_url, model_provider and the provider base_url in the active user configuration.
  2. Confirm the endpoint and listener are still needed. Back up config, correct stale overrides and restart. Remove keys and private URLs before sharing config.

macOS / Linux · CODEX_HOME

printenv CODEX_HOME

If CODEX_HOME is unset, the default is .codex in your user home directory.

Windows · PowerShell · CODEX_HOME

$env:CODEX_HOME

Context window full

Context
Context window exceeded.
Codex ran out of room in the model's context window.

The thread, images or tool output use too much context. Compaction may also fail in a full thread.

How to fix it
  1. Start a new thread from a saved handoff. Verify repository state before continuing unfinished steps.
  2. Update docs/codex-handoff.md at milestones, limit tool output and put durable rules in AGENTS.md.

Compaction failed

Context
Error running remote compact task

The context compaction request failed. Check the same log section for a specific error such as server_overloaded, context_window_exceeded or a connection timeout.

How to fix it
  1. Look for server_overloaded, context_window_exceeded or connection errors in the same log section and follow those checks.
  2. Update the client. If the old thread remains stuck, resume in a new thread from the repository and handoff instead of repeating /compact.

Sandbox file or network access

Sandbox & Git
Permission denied / Read-only file system

Writable directories, command network access and approvals are separate settings. OS file permissions may also apply.

How to fix it
  1. Check /permissions and the working directory. Confirm the target file is within the writable roots.
  2. If chat works but dependency installation or curl fails, check command network_access. Change only permissions the task needs.

Check permissions inside Codex CLI

/permissions

Git metadata write denied

Sandbox & Git
fatal: Unable to create '.git/worktrees/feature/index.lock': Permission denied

.git and a worktree’s linked Git directory may be protected as read-only even when project files are writable.

How to fix it
  1. Inspect the repository root, worktrees and Git status. Check whether the failing path is Git metadata.
  2. After editing and testing, use permitted approval for the specific Git operation or commit in your own terminal. Deleting a lock does not fix permissions.

Check repository state

git rev-parse --show-toplevel
git status --short
git worktree list

Git lock already exists

Sandbox & Git
fatal: Unable to create '.git/index.lock': File exists. Another git process seems to be running.

Another Git process may be using the repository, or an interrupted process may have left a lock.

How to fix it
  1. Check IDEs, Git clients and terminals for unfinished Git operations. Wait for them to complete first.
  2. Only handle the specific lock manually after confirming no Git process is active and the lock is stale. Never delete the whole .git directory.

Check repository state

git rev-parse --show-toplevel
git status --short
git worktree list

MCP tool or authentication error

MCP
Mcp error: -32603: Internal error

-32603 is a generic internal error, not proof of expired OAuth. If several tools fail together, check authentication first.

How to fix it
  1. Check whether the MCP server is enabled, its tools and auth status. For OAuth servers, try mcp login again.
  2. If it still fails, inspect required environment variables, processes and server logs, then the protocol. Codex account sign-in is separate from MCP sign-in.

List MCP servers

codex mcp list

Re-authenticate MCP OAuth

codex mcp login SERVER_NAME

Replace SERVER_NAME with a configured server name. Only for OAuth servers.

Config changes not applied

Client & configuration

You may have edited the wrong CODEX_HOME, the project may be untrusted, or a higher-priority layer may override the setting.

How to fix it
  1. Check /status, CODEX_HOME, CLI flags and the selected profile. Project config loads only in trusted projects.
  2. Check CLI → project → profile → user → managed/system → defaults. Verify whether provider and auth settings permit project-level overrides.

macOS / Linux · CODEX_HOME

printenv CODEX_HOME

If CODEX_HOME is unset, the default is .codex in your user home directory.

Windows · PowerShell · CODEX_HOME

$env:CODEX_HOME

AGENTS.md instructions ignored

Project workflow

Instructions merge along the directory chain. Closer files can override earlier ones, and the combined content has a size limit.

How to fix it
  1. Check global instructions and AGENTS.md / AGENTS.override.md along the working-directory path. The default combined limit is 32 KiB.
  2. After editing, start a new session and ask Codex to summarize loaded rules. Verify the working directory and CODEX_HOME.

macOS / Linux · CODEX_HOME

printenv CODEX_HOME

If CODEX_HOME is unset, the default is .codex in your user home directory.

Windows · PowerShell · CODEX_HOME

$env:CODEX_HOME

Old version or command not found

Client & configuration
command not found: codex

Multiple installations may be on PATH. The binary you run may differ from the one you updated.

How to fix it
  1. Compare versions and all command paths. Check for overlapping npm, Homebrew and standalone installations.
  2. Identify the main installation and update that one. For npm EACCES, check directory ownership rather than blindly reinstalling with sudo.

macOS / Linux

codex --version
command -v codex
type -a codex

Windows · PowerShell

codex --version
Get-Command codex -All
where.exe codex

Desktop / IDE fails, CLI works

Client & configuration

If only one client fails with the same account, network and prompt, investigate that client first.

How to fix it
  1. Fully quit and reopen the affected client. Update it and test a fresh thread.
  2. Record the CLI comparison, client version and timestamp. For an unresponsive Windows extension, check native runtimes.

Check connectivity and installation

codex doctor --summary

Requires Codex CLI. If an older version lacks Doctor, check codex --help first.

Windows sandbox or runtime

Client & configuration
Windows sandbox setup failed / VCRUNTIME140.dll missing

For sandbox startup failures, inspect .sandbox/sandbox.log. If an extension reports a missing DLL, check whether the C++ runtime is installed.

How to fix it
  1. For sandbox startup failures, restart Codex and follow official guidance for elevated/unelevated modes and .sandbox/sandbox.log.
  2. For an unresponsive extension or missing DLL, check C++ Build Tools and the x64 Redistributable. Do not share .sandbox-secrets.

Check connectivity and installation

codex doctor --summary

Requires Codex CLI. If an older version lacks Doctor, check codex --help first.

Cloud setup vs agent phase

Project workflow

Setup network access and secrets do not automatically carry over to the agent phase. Variables exported in setup do not automatically reach the agent shell either.

How to fix it
  1. Setup can access the internet to install dependencies. Agent internet access is off by default; enable it as needed in environment settings.
  2. Secrets are setup-only. A normal export does not persist across shells. Configure non-sensitive variables in the environment; never persist secrets in the repository.

Content reviewed: 2026-09-22

Search runs in your browser. Search text is not uploaded or saved.