OpenAI Codex CLI error
Codex CLI: Error logging in: Port 127.0.0.1:1455 is already in use
Error logging in: Port 127.0.0.1:1455 is already in useStatus: WorkaroundLast verified 3 documented fixes3 sources
What it means
codex login could not start its local OAuth callback server, which listens on localhost:1455 by default, so the browser sign-in cannot return credentials to the CLI. It may be preceded by "Failed to cancel previous login server: connection timed out".
Causes
- Maintainer etraut-openai (#3927): likely related to your local network configuration (firewalls, VPNs, etc.).
How to fix it
- Fix 1.
Use device code authentication (beta), which the docs prefer for headless machines or when local networking blocks the localhost callback; enable device code login in ChatGPT security settings first.
Terminalcodex login --device-auth - Fix 2.
Or sign in on a machine with a browser and copy ~/.codex/auth.json to the target machine (official auth docs).
Snippetssh user@remote 'mkdir -p ~/.codex' scp ~/.codex/auth.json user@remote:~/.codex/auth.json - Fix 3.
Or forward the callback port over SSH, then run codex login in that session (official auth docs).
Snippetssh -L 1455:localhost:1455 user@remote
More Codex CLI errors
All 14 Codex CLI errorsstream disconnected before completion: stream closed before response.completedStatus: Workaroundstream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses)Status: OpenError running remote compact task: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)Status: Fixed in releaseSelected model is at capacity. Please try a different model.Status: By designYour access token could not be refreshed because your refresh token was already used. Please log out and sign in again.Status: Fixed in releaseCodex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying.Status: Fixed in releaseToken exchange failed: token endpoint returned status 403 ForbiddenStatus: WorkaroundMCP client for `playwright` failed to start: program not foundStatus: Fixed in release
Related reading
- Codex Training Setting Re-Enabled? Two Switches to CheckDevelopers report Codex model training turning itself back on. What OpenAI documents, the second "Include environments" switch most people miss, and a five-minute check.
- OpenAI Pando: The Git Backend Built for Codex-Scale PushesOpenAI built Pando, a Git-compatible backend, after Codex flooded its monorepo with pushes. What it changed, the trade-offs, and what it means for your agent fleet.
- T3 Code: Open-Source GUI for Claude Code and CodexT3 Code is a free, MIT-licensed desktop, web and mobile app that drives Claude Code, Codex, Cursor, OpenCode and more. What it is, how remote access works, and what to check first.
- Android Studio Now Runs Claude and Codex: ACP Setup GuideAndroid Studio Rabbit 2 hosts 40+ ACP coding agents, Claude and Codex included, and Android CLI ships as a Claude Code and Codex plugin. Setup and caveats.
- Codex Could Not Start in VS Code: What the Error Means and How to Fix ItCodex shows "The extension could not start its user interface" in VS Code, Remote SSH, Dev Containers and Cursor. Read the log first, then pick the fix that matches.
- GPT-6.1 Terra: $1/$5 Pricing, Benchmarks, and When to Pick ItGPT-6.1 Terra is OpenAI's new $1/$5 per million token model: 50.3% on Terminal-Bench 4.0 (vendor-reported), half Sol's price, and who should route to it.
FAQ
What does "Error logging in: Port 127.0.0.1:1455 is already in use" mean in Codex CLI?
codex login could not start its local OAuth callback server, which listens on localhost:1455 by default, so the browser sign-in cannot return credentials to the CLI. It may be preceded by "Failed to cancel previous login server: connection timed out".
How do I fix "Error logging in: Port 127.0.0.1:1455 is already in use"?
There are 3 documented fixes. Start with the first: Use device code authentication (beta), which the docs prefer for headless machines or when local networking blocks the localhost callback; enable device code login in ChatGPT security settings first.
Is this Codex CLI error fixed?
Status: Workaround. No release removes the cause. The documented fixes work around it. Affected versions: Reported on codex-cli 0.39.0 under WSL (#3927)
Sources
Last verified against 3 sources: official docs, maintainer replies and release notes.
Newsletter
Fixes for the tools you use, weekly
One email per week. New coding agent releases, what broke, and how developers are working around it.