Codex CLI 0.30 Only - stream error: unexpected status 400 Bad Request: {"detail":"Instructions are not valid"};
Resolved 💬 24 comments Opened Sep 5, 2025 by rwjdk Closed Sep 5, 2025
💡 Likely answer: A maintainer (dylan-hurd-oai, contributor)
responded on this thread — see the highlighted reply below.
What version of Codex is running?
0.30
Which model were you using?
gtp-5 medium
What platform is your computer?
Windows 11
What steps can reproduce the bug?
- Install 0.30
- run Codex
- prompt 'hi' or any other message
What is the expected behavior?
That Codex answer back or begin coding
What do you see instead?
You get this:
***
▌hi
⚠️ stream error: unexpected status 400 Bad Request: {"detail":"Instructions are not valid"}; retrying 1/5 in 193ms…
⚠️ stream error: unexpected status 400 Bad Request: {"detail":"Instructions are not valid"}; retrying 2/5 in 373ms…
⚠️ stream error: unexpected status 400 Bad Request: {"detail":"Instructions are not valid"}; retrying 3/5 in 776ms…
⚠️ stream error: unexpected status 400 Bad Request: {"detail":"Instructions are not valid"}; retrying 4/5 in 1.718s…
⚠️ stream error: unexpected status 400 Bad Request: {"detail":"Instructions are not valid"}; retrying 5/5 in 2.91s…
🖐 unexpected status 400 Bad Request: {"detail":"Instructions are not valid"}
Additional information
- Installed from the download as not ready on npm yet
- Error happens both in normal Windows and WSL
24 Comments
same
Same here
<img width="762" height="436" alt="Image" src="https://github.com/user-attachments/assets/894201ca-9378-4559-aadf-f259db3bbbf3" />
Same on Mac OS after update by
npm i -g @openai/codexP.s. It's solved! 🎉🎉🎉
<img width="859" height="557" alt="Image" src="https://github.com/user-attachments/assets/0135b887-5c03-4e06-ada2-a7f63133e63b" />
Seems we have a FUBAR build on both Windows and Mac... So at least we will properly get a quick fix...
same here
Yep, same issue here. They've probably broken the system instruction the backend API validates on requests.
Seems specific to 0.30.0, while a fix arrives (or update on OpenAI endpoints), workaround is going back to version 0.29.0:
npm install -g @openai/codex@0.29.0same here
Likely broken by https://github.com/openai/codex/pull/3122 where they modified prompt.md which is strictly validated by the backend endpoints to validate Plus/Pro subscriber use through codex cli.
Tried to delete my Agent.md but did not resolve, so it is not our Instructions that are invalid
Same here.
same
+1 on linux
Seems OpenAI endpoits have been changed. It's fixed at 0.30.0.
It's solved. Everyone, try again
Hi folks - this should be fixed. Please let us know if you're still hitting errors!
Confirmed fixed for me.
I see this issue after updating it to CLI 0.36.0 on Linux
similar - codex-cli 0.41.0
Yes, getting the same as @mgscox . This happens when I use openai api key for the requests.
This issue is closed and those are different 400 errors than this issue was reporting.
The cause on this issue was at 0.30.0 release the system prompt changed and the
chatgpt.com/backend-api/codex/responsesvalidates the Codex CLI system prompt - the mismatch was causing 400 rejection with{"detail":"Instructions are not valid"}message.You guys are reporting 400 errors, but totally different error message - probably best to create a separate issue if you've not already done so.
If you have a plus subscription and re-auth using api-key (or another authentication) you cannot resume the conversation you must start a new one. I can only assume the prior auth-keys are in the headers somewhere which now conflicts with the new ones. I had this exact problem when I ran out of tokens and switched to API billing.
Resolvi o problema apagando a pasta .codex e reinstalando a extensão
Same
I've tried multiple times over the past month or two -- recreating API keys, reinstalling codex (brew install and with npm), watching it fail every time ... every damned time.
Never -not once - has codex ever run on my mac.
This is as best it gets:
unexpected status 400 Bad Request: {"success":false,"error":
{"name":"ZodError","message":"[\n {\n \"code\": \"invalid_union\",
\n \"errors\": [],\n \"note\": \"No matching discriminator\",\n
\"discriminator\": \"type\",\n \"path\": [\n \"tools\",\n 5,\n
\"type\"\n ],\n \"message\": \"Invalid input\"\n }\n]"}}