Codex CLI login stuck on 'Sign in with ChatGPT' screen

Resolved 💬 4 comments Opened Jan 2, 2026 by christopher-hesse Closed Aug 5, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

codex-cli 0.77.0

What subscription do you have?

Pro

Which model were you using?

_No response_

What platform is your computer?

Microsoft Windows NT 10.0.19045.0 x64

What issue are you seeing?

It looks like I ran into the same issue as https://github.com/openai/codex/issues/2763. I have 2+ VSCode windows (using devcontainers) open, and they both are mapping local ports to 1455:

<img width="1399" height="141" alt="Image" src="https://github.com/user-attachments/assets/05664d07-dc00-4e35-8b54-8879d24d2d25" />

<img width="1142" height="151" alt="Image" src="https://github.com/user-attachments/assets/00a3f002-2606-4787-b728-669f0cf1ffa1" />

While it says "User Forwarded", I don't recall making this forwards.

When I login via ChatGPT it hangs on this screen after hitting the continue button:

<img width="633" height="540" alt="Image" src="https://github.com/user-attachments/assets/e52649c3-00b0-4fad-a43f-09dd30f1a429" />

Based on this comment:

#issuecomment-3403393675

I closed one of the windows (the first picture), and now get:

<img width="530" height="487" alt="Image" src="https://github.com/user-attachments/assets/49afbf7c-3ce3-4e57-adef-c221e5b170f6" />

I rebuilt the devcontainer in the window that was still open, but that didn't fix it (same error as above):

<img width="1134" height="152" alt="Image" src="https://github.com/user-attachments/assets/62308a22-44a2-4bd5-a7b0-d74156cf802b" />

Next I reopened the project in VSCode and relaunched the devcontainer but got the same issue. I closed all vscode windows, and then reopened the project + relaunched the devcontainer but still have the same issue. Rebooting computer didn't seem to fix it. Deleting the forwarded port and re-adding it fixed it though.

What steps can reproduce the bug?

I haven't tried to reproduce it, but likely logging into codex with two different vscode windows + devcontainers might do it.

What is the expected behavior?

I would expect it to work or provide a better error message, if possible.

Additional information

_No response_

View original on GitHub ↗

4 Comments

etraut-openai contributor · 7 months ago

Please refer to this documentation for headless login.

christopher-hesse · 7 months ago

Thanks! I suspect device code or copying auth cache would also work.

I think I observed this both with the codex CLI and VSCode extension (also running inside a devcontainer). If other people are running into this issue, should there be a better error message, or is that too hard to do here? Maybe the client could suggest it if it detects that it's likely running in a headless mode.

ElectroTiger · 7 months ago

I just ran into this issue too, and I realized what the problem was. I had ChatGPT format it a bit:

Root Cause Analysis

This appears to be a port-forwarding conflict caused by Codex CLI’s fixed OAuth callback port combined with VS Code devcontainer behavior.

What’s happening:

  1. Codex CLI is hard-wired to listen for the OAuth callback on port 1455.
  2. When running inside a VS Code devcontainer, VS Code automatically forwards detected container ports to the host using the same port number when possible.
  3. After a successful Codex login, VS Code does not remove the 1455 port forward.
  4. If you have multiple VS Code windows / devcontainers open:
  • The first instance reserves 1455 → 1455 on the host.
  • A second instance cannot claim host port 1455, so VS Code remaps it (e.g. 1455 → 1456) while still showing it as “User Forwarded”.
  1. During login on the second instance, the browser attempts to call back to localhost:1455, but no process is listening there — causing the login flow to hang indefinitely on the “Sign in with ChatGPT” screen.

This explains why the issue only appears with multiple devcontainers and why it looks like auth succeeds but never completes.

---

Workaround / Fix

  1. In all open VS Code windows, open the Ports panel.
  2. Delete any forwarded port entries for 1455.
  3. In the VS Code instance you want to authenticate from, retry your codex login process.
  • You should see 1455 correctly map to 1455 on the host.
  • Authentication should now complete successfully.
  1. (Optional but recommended) After login completes, delete the 1455 port forward again to avoid conflicts in other devcontainers.

---

Suggested Improvement for Codex authors

Detect when you're operating in a devcontainer context, so that we can automatically close the forwarded port after authentication completes.

franklesniak · 3 months ago

Thank you for posting this workaround. I just lost an hour of my life to this issue that I'll never get back.

Hope to see a fix for this soon.