stream error: unexpected status 404 Not Found: {"detail":"Not Found"}

Resolved 💬 2 comments Opened Aug 28, 2025 by Tor-Saxberg Closed Nov 18, 2025
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

0.25.0

Which model were you using?

gpt-5

What platform is your computer?

Darwin 24.5.0 arm64 arm

What steps can reproduce the bug?

npm i -g @openai/codex
codex
continue using api key

write any message in codex.

What is the expected behavior?

a valid response.

What do you see instead?

user
hi
⚠  stream error: unexpected status 404 Not Found: {"detail":"Not Found"}; retrying 1/5 in 202ms…

⚠  stream error: unexpected status 404 Not Found: {"detail":"Not Found"}; retrying 2/5 in 417ms…

⚠  stream error: unexpected status 404 Not Found: {"detail":"Not Found"}; retrying 3/5 in 776ms…

⚠  stream error: unexpected status 404 Not Found: {"detail":"Not Found"}; retrying 4/5 in 1.571s…

⚠  stream error: unexpected status 404 Not Found: {"detail":"Not Found"}; retrying 5/5 in 2.925s…


🖐  unexpected status 404 Not Found: {"detail":"Not Found"}

Additional information

this issue is similar, but their error message says

{"message":"Route POST:/api/v1/684570d09bf5b9*****/responses not found","error":"Not Found","statusCode":404}

unset OPENAI_BASE_URL doesn't resolve the issue.

here's the ~/.codex/sessions data, rollout-2025-08-28T13-07-35-5f1a...

{"id":"5f1a...","timestamp":"2025-08-28T13:07:35.605Z","instructions":null,"git":{"commit_hash":"251ce...","branch":"master"}}
{"record_type":"state"}
{"type":"message","id":null,"role":"user","content":[{"type":"input_text","text":"<environment_context>\n  <cwd>/Users/...</cwd>\n  <approval_policy>on-request</approval_policy>\n  <sandbox_mode>workspace-write</sandbox_mode>\n  <network_access>restricted</network_access>\n  <shell>zsh</shell>\n</environment_context>"}]}
{"record_type":"state"}
{"type":"message","id":null,"role":"user","content":[{"type":"input_text","text":"hi"}]}
{"record_type":"state"}

and here's the log:

...
^[[2m2025-08-28T20:08:02.383541Z^[[0m ^[[33m WARN^[[0m stream disconnected - retrying turn (5/5 in 2.925s)...
^[[2m2025-08-28T20:08:05.375711Z^[[0m ^[[32m INFO^[[0m Turn error: unexpected status 404 Not Found: {"detail":"Not Found"}

View original on GitHub ↗

2 Comments

Starlordpd233 · 12 months ago

Hi!
Since you're using macOS, which is the same that i used, try to open your configuration or shell (~/.zshrc) and see if you have any openai keys or base url set up in there. I had the exact same problem as you did, and I figured out that it was because I was previously using the openai api keys and base url for qwen coder which I set in my shell ~/.zshrc file. After removing them and do 'source ~/.zshrc' the probelm resolved and codex worked for me.

So do:

code ~/.zshrc or nano depending on your mac config
delete the openai settings
source ~/.zshrc
and try to sign in codex again.

etraut-openai contributor · 9 months ago

I think this issue is no longer relevant, so I'm closing it. If you are seeing similar problems with the most recent versions of codex, please open a fresh issue and use the /feedback tool to provide details.