unexpected status 502 Bad Gateway - Errors Constantly from Toronto Canada

Resolved 💬 7 comments Opened Jan 12, 2026 by lasertiger Closed Jan 17, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

v0.80.0

What subscription do you have?

Team / Business

Which model were you using?

5.2

What platform is your computer?

Darwin 25.0.0 arm64 arm

What issue are you seeing?

  • For a few weeks, am getting 502 errors from Cloudflare.
  • Even if i exit codex cli and resume session, it does not fix things.
  • BUT - it is session specific, some sessions work fine, some do not.
  • It is like some cookies or token something that might steer to a specific sever gets cached and i can't fix fix.
  • Once a session starts doing this it becomes unusable and unrecoverable.
  • It is not always 100% failure! Sometimes after an hour a request might get through.
  • Some requests pass, occasionally, but it hangs for like 16 minutes sometimes in a retry loop.
  • I do not have any issues with any other sites and my internet speed/reachability seems happy/healthy.

Here are some examples:

■ unexpected status 502 Bad Gateway: <html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>cloudflare</center>
</body>
</html>
, request id: 9bcf27732f28ab39-YYZ

or

unexpected status 502 Bad Gateway: <html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>cloudflare</center>
</body>
</html>
, request id: 9bc882e92dec38e2-YYZ

but never via the web chat, only via CODEX CLI.

I am using Rogers ISP. Sometimes when i switch to mobile internet (Also Rogers) via my phone it works, but today that also did not work at all.

It destroys HOURS of productivity - I am basically dead in the water here.

Again - it does not affect all my CODEX sessions. I feel the more long-lived they are the higher chance of this happening.

What steps can reproduce the bug?

Using codex cli

What is the expected behavior?

Not getting Cloudflare 502 errors!

Additional information

_No response_

View original on GitHub ↗

7 Comments

github-actions[bot] contributor · 6 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #9100

Powered by Codex Action

etraut-openai contributor · 6 months ago

Can you try to use the /feedback slash command and upload your logs and post the thread ID here? We've had one other report of this issue, but we've been unable to get any logs, and the problem is not showing up in our backend analytics.

lasertiger · 6 months ago

Thread ID is: 019bb4f8-6d4d-7663-8c64-8aec530a8ebe

lasertiger · 6 months ago

Has been happening all day. my productivity is 1/2 at least due to it.

etraut-openai contributor · 6 months ago

Apologies if you are affected by this issue. We continue to get a smattering of reports of this, but we're struggling to pin down the cause because 1) it seems to be happening to a very small number of users, 2) we're not seeing any evidence of it in our backend systems, and 3) users who hit this are unable to upload their logs using /feedback.

We suspect it's related to our Cloudflare gateway, but we need some additional clues to pin it down.

If you are experiencing this, here's how you can help us out:

  1. Install the latest alpha:

npm i -g @openai/codex@0.82.0-alpha.2
(note the dash: -alpha.2)

  1. Enable tracing:

export RUST_LOG="warn,codex=trace"

  1. Reproduce the problem, then exit Codex cleanly so logs flush.
  1. Open ~/.codex/log/codex-tui.log and search for 502. On that line, find "headers={" and copy the HTTP headers.

Important:

  • Include the cf-ray header if present.
  • Do not include Authorization, Cookie, or API key headers.

Also tell us:

  • Your OS (macOS / Linux / Windows)
  • Whether you are behind a corporate proxy or VPN

This will let us correlate Cloudflare failures on their side.

etraut-openai contributor · 6 months ago

Closing for lack of response.

QormeSabz · 2 months ago

Codex version: 26.513.11550, Windows app:

unexpected status 502 Bad Gateway: <html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>cloudflare</center>
</body>
</html>, url: https://chatgpt.com/backend-api/codex/responses, cf-ray: 9fc44752daaa6873-IAH,  9fc445dbeb2ac9ba-IAH, 9fc448172e2a4a59-IAH, and  9fc4491ecfb8f019-IAH