Troubleshooting7 min read

Troubleshoot Codex configuration: 401, 404, stale models, and client differences

Narrow down configuration, authentication, routing, and execution failures one layer at a time, with a redacted reproduction template.

Preserve the evidence first

Record the surface, host, version, working directory, request time, and original error. Redact keys and sensitive identifiers. Change one setting at a time and repeat the same small task so that a successful result has an explainable cause.

Initial checks do not require printing auth.json
codex --version
codex login status
printf '%s\n' "${CODEX_HOME:-$HOME/.codex}"

Locate the failing layer

SymptomFirst checksAvoid this assumption
TOML startup errorQuoting, duplicate keys, tables, supported versionIt proves nothing about the key
401 / 403Credentials, process environment, server permissionsThe key must simply be expired
404Actual path, Base URL, Responses supportAdding another /v1 will fix it
Unknown modelExact ID and provider authorizationDisplay names are API IDs
Stale modelOverrides and existing processesSaving forces a running session to reload
Denied commandSandbox, approvals, managed requirementsThe model API must be broken

For 401, examine authentication and routing together

Distinguish cached official authentication from a custom provider’s env_key. Check login status and storage for the former, and process-visible variables for the latter. A third-party key sent to an official endpoint is a routing error as well as an authentication failure. A 403 can involve account or model access; inspect the actual response.

For 404, find the actual request path

Use provider logs or redacted diagnostics to identify the endpoint. Confirm the Base URL prefix and Responses support. Current wire_api supports responses only; a working Chat Completions endpoint is not sufficient. If the provider sees no request, investigate DNS, proxies, and connection failures before blaming the model.

Compare the Client and CLI systematically

  1. Confirm the execution host and CODEX_HOME on both sides.
  2. Check CLI flags, selected profiles, and trusted project overrides.
  3. Verify that the graphical process can access required variables; a terminal export is not proof.
  4. Fully restart and create a new session, then verify the new request in upstream logs.

Share a minimal redacted reproduction

A useful issue template
Surface and version:
Operating system; local or remote:
Working directory and CODEX_HOME (redacted):
Expected model and provider:
Actual error and time:
Configuration layers checked:
Smallest reproduction steps:
Results before and after the change:

Do not include a real key, full auth.json, or an entire chat transcript. Preserve field structure while redacting secrets. Validate a small task before returning to a long conversation. Be specific about what remains unknown: “authentication works; the route is not yet confirmed” is actionable.

Continue with credentials, provider routing, configuration precedence, or the interactive error doctor.

Sources and version notes

Based on the official documentation below. Replace example URLs, models, and paths for your environment. Older versions and managed environments may differ.

Sources checked:

More guides

Put your configuration to work

Generate a configuration, follow the setup flow, or diagnose the next issue.

Client + CLI setupOpen configuration tools