Summary: Most Codex CLI problems fall into four buckets: the browser sign-in can't reach your terminal, the sandbox blocks a command (or can't start at all on Linux), an old config value stops the CLI from launching, or you've hit your plan's usage window. This guide walks through each one with the exact commands and settings from OpenAI's current Codex docs, so you can find the cause in a few minutes instead of reinstalling. Everything below was checked against the official documentation on the date at the bottom.
Before you start: three quick checks
A surprising number of "Codex is broken" reports turn out to be version or account mix-ups. Run these first:
- Check the version. Run
codex --version. OpenAI's troubleshooting page notes that the ChatGPT desktop app and the CLI can ship different Codex versions, so a feature you saw in the app may not have reached your CLI yet (or the other way round). Update with the same method you installed with: the standalone installer (curl -fsSL https://chatgpt.com/codex/install.sh | shon macOS/Linux),npm install -g @openai/codex, orbrew upgrade --cask codex. - Check who you're signed in as. Run
codex login status. It tells you whether the CLI is using a ChatGPT sign-in or an API key, which changes both billing and which models you can pick. - Check your remaining usage. Inside a session, type
/status. If you're out of your five-hour or weekly allowance, nothing else on this list will help until it resets.
Problem 1: "Sign in with ChatGPT" never finishes
When you run codex login (or start codex for the first time), the CLI opens a browser, you sign in, and the browser hands a token back to a small local callback server on localhost:1455. If the browser can't reach that port, the login hangs or fails. The docs name two typical causes: you're on a remote or headless machine (SSH box, dev container, cloud VM), or local network settings block the localhost callback.
Fix A: use device code sign-in
- Turn on device code login first. For a personal account it's in your ChatGPT security settings; in a workspace, an admin enables it in workspace permissions. This step is easy to miss, and it's the usual reason the option seems not to work.
- In the terminal, run
codex login --device-auth, or choose Sign in with Device Code in the interactive login screen. - Open the printed link on any device with a browser, sign in, and type the one-time code.
OpenAI still labels device code sign-in as beta, so keep the fallbacks below in mind.
Fix B: forward the callback port over SSH
If you connect to the remote machine over SSH, tunnel the callback port from your laptop with ssh -L 1455:localhost:1455 user@remote, run codex login inside that session, and open the printed address in your local browser. The token travels back through the tunnel.
Fix C: copy the login cache
Sign in on a machine that has a browser, confirm that ~/.codex/auth.json exists, and copy it to the same path on the headless machine (for example with scp). This only works when Codex stores credentials in that file rather than in your OS keychain; the cli_auth_credentials_store setting controls that (file, keyring, auto or ephemeral). Treat auth.json like a password, because it contains access tokens.
Corporate network or TLS proxy?
If your company inspects HTTPS traffic with its own root certificate, point Codex at it before logging in: export CODEX_CA_CERTIFICATE=/path/to/corporate-root-ca.pem, then codex login. When that variable is unset, Codex falls back to SSL_CERT_FILE. For anything still unclear, each direct codex login run writes a codex-login.log file in your log directory, which is the file support will ask for.
Using an API key instead
For CI or shared machines, an API key is often simpler: printenv OPENAI_API_KEY | codex login --with-api-key. Just know the trade-off. API-key sessions are billed at standard API rates through your OpenAI Platform account and don't include cloud features such as GitHub code review or the Slack integration.
Problem 2: the CLI won't start after an update
If Codex suddenly refuses to launch, check your config for approval_policy = "untrusted". OpenAI has retired that value, and the docs warn it "can prevent either client from starting." Look for it in ~/.codex/config.toml, any project .codex/config.toml, profile files and startup scripts.
The documented replacement for cautious, read-only use is:
sandbox_mode = "read-only"
approval_policy = "on-request"
If you liked the old behaviour where every command needed approval, remove the explicit approval_policy and add a project entry with trust_level = "untrusted" under [projects."/path/to/project"] in your user-level config. Note that this also disables project-local configuration for that folder.
Another settings surprise: Codex reads config from several layers, and the closest one wins. In order of priority it's command-line overrides, then trusted project .codex/config.toml files (closest folder first), then a profile chosen with --profile, then ~/.codex/config.toml, then cloud-managed defaults, then /etc/codex/config.toml. If a setting "doesn't stick," a higher layer is usually overriding it. Project layers load only after you trust the project.
Problem 3: sandbox errors on Linux and WSL
On macOS the sandbox uses the built-in Seatbelt framework and needs no setup. On Linux and WSL2, Codex expects bubblewrap:
- Ubuntu/Debian:
sudo apt install bubblewrap - Fedora:
sudo dnf install bubblewrap
Without a bwrap on your PATH, Codex falls back to a bundled helper that needs unprivileged user namespaces, and you'll see a startup warning if it can't create one. On Ubuntu 24.04 the warning can persist even after installing bubblewrap because of AppArmor. The documented fix is to install apparmor-profiles and apparmor-utils, copy /usr/share/apparmor/extra-profiles/bwrap-userns-restrict into /etc/apparmor.d/, and load it with sudo apparmor_parser -r /etc/apparmor.d/bwrap-userns-restrict. That keeps the system-wide restriction in place; disabling it with sysctl is the last resort the docs mention, not the first.
WSL1 users: WSL1 was supported through Codex 0.114. From 0.115 the Linux sandbox moved to bubblewrap and WSL1 is no longer supported, so convert the distro to WSL2. On native Windows (PowerShell), Codex uses its own Windows sandbox instead.
Problem 4: commands are blocked or keep asking for approval
This is usually the sandbox working as designed. In the default Auto preset (--sandbox workspace-write --ask-for-approval on-request), Codex can read, edit and run commands inside your working folder, but it asks before touching files outside it or using the network. A few details that trip people up:
- No internet for commands. In
workspace-write, network access is off unless you addnetwork_access = trueunder[sandbox_workspace_write]. That's whynpm installorpip installrun by the agent may fail even though your own shell is online. - Some folders stay read-only. Inside writable roots,
.git,.codex,.agentsand.awsare protected. If Codex can't commit or edit its own config, that's why. - Starts in read-only. In a folder you haven't trusted yet, or one that isn't under version control, Codex may start read-only. Use
/permissionsto check and change the mode. - Fewer prompts, same boundary. If the prompts slow you down, Auto-review mode (
approvals_reviewer = "auto_review") keeps the same sandbox but lets a reviewer model handle eligible approvals. It uses extra model calls, so it adds to usage.
The nuclear option, --dangerously-bypass-approvals-and-sandbox (alias --yolo), removes both the sandbox and approvals. OpenAI marks it "not recommended"; reserve it for throwaway containers.
Problem 5: limits, missing models and "it stopped mid-week"
Codex with ChatGPT sign-in shares one allowance with ChatGPT Work. Plus and Standard Business get a five-hour window plus possible weekly limits; Pro plans currently have no five-hour limit. Usage varies a lot with model, context and tool use, so long sessions in a big repo burn through faster than short ones. If you run out mid-turn, the current turn is allowed to finish. After that, Plus and Pro users can buy credits, or anyone can continue local chats with an API key at API rates.
If a model you used to select has disappeared, check the date: GPT-5.5 retired from Codex for ChatGPT sign-ins on October 14, 2026. The docs suggest GPT-6.1 Sol on Plus and higher plans and GPT-6 Luna on Free and Go. Replace gpt-5.5 anywhere you pinned it: config files, custom agents, scheduled tasks and scripts. API-key sessions weren't affected.
Codex plans at a glance
| Option | Price | Where Codex runs | Worth knowing |
|---|---|---|---|
| Free | $0/month | Desktop app (GPT-6 Luna, subject to rollout) | No image generation; the pricing card doesn't list the CLI |
| Go | $8/month | Desktop app (GPT-6 Luna, subject to rollout) | Aimed at lightweight coding tasks |
| Plus | $20/month | Web, CLI, IDE extension, iOS | GPT-6.1 Sol and GPT-6 Luna; five-hour window; can add credits |
| Pro | From $100/month ($100, $200 or $500 tiers) | Everything in Plus | No five-hour limit currently; Ultrafast mode on the $500 tier |
| API key | Standard API rates | CLI, SDK, IDE extension | No cloud features (GitHub review, Slack); good for CI |
Prices are in USD as listed on OpenAI's Codex pricing page. Business is $20 per user per month billed annually for 2+ users ($25 monthly).
Editor's note
Who this is for: developers who run Codex in a terminal, especially over SSH, in containers, on Ubuntu or in WSL. Less useful for: people who only use the ChatGPT desktop app, where most of these knobs live behind the permissions menu instead.
Gotchas I'd watch for: device code sign-in must be switched on in your ChatGPT security settings before the flag works; auth.json copying fails silently if your OS keychain holds the credentials; and an old "untrusted" approval value left in a profile file is the sneakiest cause of a CLI that won't start.
Common errors and fixes: login hangs on a server, so use --device-auth or an SSH tunnel on port 1455. Bubblewrap or user-namespace warnings on Ubuntu 24.04 need the AppArmor profile. Package installs fail inside the agent because network access is off by default in workspace-write. If a model is missing, replace pinned gpt-5.5 values.
Still stuck? Where the logs are
Session transcripts live in ~/.codex/sessions (or $CODEX_HOME/sessions), archived ones in archived_sessions. If a session looks frozen, OpenAI's own checklist is: see whether Codex is waiting for an approval, run a basic command such as git status, then start a new chat with a smaller, focused prompt. Bugs go to the openai/codex GitHub issues; read your logs before sharing them, since they can contain sensitive data. You'll find screenshots of the official docs pages I used at the end of this post.
FAQ
Can I use Codex CLI with the free ChatGPT plan?
The current pricing page lists the CLI under Plus and above. The Free and Go cards mention only GPT-6 Luna in the desktop app. If you want the CLI without a subscription, sign in with an API key and pay standard API rates.
Why does Codex say I'm out of usage when I barely used it?
Allowance depends on model, context size, reasoning and tool use, not just message count, and Codex shares it with ChatGPT Work. Check /status or the usage dashboard, and try a smaller model for routine tasks.
Is it safe to run with --yolo?
Only somewhere you're happy to lose. It turns off both the sandbox and approvals. For hands-off runs, the docs suggest --sandbox read-only --ask-for-approval never for read-only CI, or Auto-review mode when you need edits.
Related on lightmind24: Aider Not Working? Fixes for Edit, Token and API Key Errors, Cline Tutorial: Plan, Act and Roll Back Safely in VS Code, and Antigravity CLI Setup: Move From Gemini CLI Step by Step.
Fix the login and the sandbox first, and almost everything else in Codex becomes a settings question.
Images: screenshots of OpenAI's public Codex documentation (learn.chatgpt.com), captured by lightmind24.
Last verified: 2026-11-01
Sources: Codex CLI, Authentication, Sandbox, Agent approvals & security, Config basics, WSL, Pricing, Models, Troubleshooting.
댓글
댓글 쓰기