Reconnecting 502 Bad Gateway
What version of Codex is running?
0.79.0
What subscription do you have?
Pro
Which model were you using?
gpt-5.1-codex-max, gpt-5.2-codex
What platform is your computer?
Darwin 25.1.0 arm64 arm
What issue are you seeing?
Been facing reconnecting issues for the past 1-2 days. Codex is generally able to read through my codebase before running into this issue. But as soon as it starts to do some work, it generally fails pretty quickly with a reconnecting issue.
````
• Reconnecting... 4/5 (16m 38s • esc to interrupt)
└ Unexpected status 502 Bad Gateway: <html>
<head><title>502 Bad Gateway</title></head>
<body>…
````
````
■ 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:
````
What steps can reproduce the bug?
Thread ID: 019b9f87-7391-7ae2-93a0-f25ca7fa218a
Edit: I saw in another reply that my logs are unavailable, possibly because of the bug in this issue. Is there something else I can do to provide the relevant information?
What is the expected behavior?
Task completion
Additional information
_No response_
5 Comments
@AkanshDivker, thanks for reporting this. The error you're seeing is coming from our CloudFlare gateway. Our analytics show that we're seeing occasional 502's, but they are extremely infrequent. Assuming they're evenly distributed, it's very unlikely that one user would ever see two of them. You mentioned that you're seeing this repeatedly. Are you sure it's this same 502 error every time, or is it possible that your other "Reconnecting" messages reported a different error? If you are seeing repeated 502's, we'll need to figure out what's special about your account or connection that would cause this problem specifically for you.
@etraut-openai I've seen the 502s repeatedly over the course of yesterday and today. I started cancelling them during the Reconnecting step since they all mostly ended up failing after 5 attempts anyway, so I didn't see the final error message for all of them.
I don't think all of them were Cloudflare errors, but they were somewhat common. Others were errors in connecting to the OpenAI Codex Backend API.
I'll try getting a few more results if it's helpful.
Yes, please. And also try using
/feedbackagain. The detailed logs might be useful, so if we can get those to upload, that would be helpful.@etraut-openai I haven't had this issue occur again since then. Apart from the time that passed, the only thing I did was restart my computer and terminal. Not sure if you'd like to leave this open still, but I can also create another issue if it comes up again and I have more information to share
Thanks for getting back to us. My best guess is that this was a bad CloudFlare server that you happened to get routed to consistently over that time period. I'm glad to hear that you're no longer experiencing it.