Skip to main content
Watch: I Built an AI App Without Leaving Databricks

OpenAI Codex CLI error

Codex CLI: Error logging in: Port 127.0.0.1:1455 is already in use

Error message
Error logging in: Port 127.0.0.1:1455 is already in use

Status: 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

  1. 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.

    Terminal
    codex login --device-auth
  2. Fix 2.

    Or sign in on a machine with a browser and copy ~/.codex/auth.json to the target machine (official auth docs).

    Snippet
    ssh user@remote 'mkdir -p ~/.codex'
    scp ~/.codex/auth.json user@remote:~/.codex/auth.json
  3. Fix 3.

    Or forward the callback port over SSH, then run codex login in that session (official auth docs).

    Snippet
    ssh -L 1455:localhost:1455 user@remote

More Codex CLI errors

All 14 Codex CLI errors

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.