“stream disconnected before completion” + “input exceeds context window” loop
Resolved 💬 23 comments Opened Sep 24, 2025 by zjsng 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.40.0
Which model were you using?
gpt-5-codex (medium)
What platform is your computer?
Darwin 24.6.0 arm64 arm
What steps can reproduce the bug?
For me, everytime it completes a yarn test command, it seems to trigger this issue. It likely tried to read the entire output of yarn test and caused a soft lock of the conversation.
What is the expected behavior?
It shouldn't cause a soft lock of the current conversation, as I am not able to run /compact or any other command to avoid losing all context.
What do you see instead?
⚠️ stream error: stream disconnected before completion: Your input exceeds the context window of this model. Please
adjust your input and try again.; retrying 1/5 in 197ms…
⚠️ stream error: stream disconnected before completion: Your input exceeds the context window of this model. Please
adjust your input and try again.; retrying 2/5 in 374ms…
⚠️ stream error: stream disconnected before completion: Your input exceeds the context window of this model. Please
adjust your input and try again.; retrying 3/5 in 869ms…
⚠️ stream error: stream disconnected before completion: Your input exceeds the context window of this model. Please
adjust your input and try again.; retrying 4/5 in 1.634s…
⚠️ stream error: stream disconnected before completion: Your input exceeds the context window of this model. Please
adjust your input and try again.; retrying 5/5 in 3.042s…
■ stream disconnected before completion: Your input exceeds the context window of this model. Please adjust your input
and try again.
Additional information
_No response_
Showing cached comments. Read the full discussion on GitHub ↗
22 Comments
I get the same thing - stream error: stream disconnected before completion: Your input exceeds the context window of this model. Please adjust your input and try again.; retrying 2/5 in 434ms…
I try a different model - same thing. Try ChatGPT5 Account - Same thing - Try with Api key - same thing. ouch
+1 here, same errors, makes the new model pretty much unusable now. Downgrading to GPT5 regular is not a solution as its terrible at coding work.
For anyone else having the same issue, I made a workaround for the problem by saving in
AGENTS.mdan instruction to output the problematic terminal commands into a file and then reading it+1, This issue is too affecting work.
same issue here, it says that I've exceeded my context yet when I check rate usage 5h limit 0% used · resets 11:13 PM
and Weekly limit 10% used · resets Oct 1.
Switched to norma and codex thinking modes without success, changed to prerelease and back to latest and there is no difference, this extension is completly locked which makes no sense given my context usage.
+1, model is pretty unusable for detailed work right now.
Just encountered this. So while this issue persists I gonna use Claude Code CLI.
It should auto compact before blowing up!
I got this despite having a lot of context left, so my guess is the most recent tool call had a result so huge it immediately crossed the limit. Using
/compactdidn't resolve this because it seems the tool result is still included in that flow.So it would be nice to be able to
/undoor something which would take me back one step in the chat history, so I can keep using my 1 hour session by telling the AI how to proceed differently instead of just losing everything that was built up in that time...(I know transcript has "edit prev" which lets me roll back my own messages, but that would roll back the majority of my session since Codex was in control for the most part.)
I have not hit my rates and I am getting this:
<img width="471" height="523" alt="Image" src="https://github.com/user-attachments/assets/fdd74c46-268d-4560-bf05-822b79629fbf" />
This is incredibly frustrating and making me want to move outside of ChatGPT.
Same issue here! I haven't reached my rates yet.
same issued. please fix.
In my case, pytest output was blowing up all the limits with huge 23k line output. I solved it by adding this to agents.md:
pytest_output.txt(e.g., append> pytest_output.txtor| tee pytest_output.txt) and read results from that file.pytest_output.txtso it only contains fresh output.Can some conform if this work?
Same here
<img width="872" height="1313" alt="Image" src="https://github.com/user-attachments/assets/ddf31f26-1379-44ca-ba1c-5c72d777d963" />
This is fraustrating.
tried every possible fix but looks like its not local but an openai issue.
Please fix this issue.
The same problem
same here
Same here. This is the only thing keeping me from fully switching to Codex. Such a pity: great model, but the UX is too rough right now. Claude Code is miles ahead in that regard.
Same problem here, seems unrecoverable once it happens it requires a fresh conversation.
Also reported in issue #2921
What a stupid bunch openai is, why don't you know the correct answer to the reference Claude?
I think this issue is now addressed. If you are still seeing this with the latest version of codex, please open a new issue with repro steps and relevant details.