Stream disconnected before completion
What version of Codex is running?
v0.39.0
Which model were you using?
gpt-5-codex high (but with all models)
What platform is your computer?
WSL (Linux on windows)
What steps can reproduce the bug?
I was fixing an error in my codebase and at a certain point it started giving me stream errors, which is impossible, since I don't have any network problems and the context I'm giving it is very small. This only happens with the new version; I never had this problem before:
⚠️ 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 208ms…
⚠️ 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 378ms…
⚠️ 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 837ms…
⚠️ 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.482s…
⚠️ 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.035s…
■ stream disconnected before completion: Your input exceeds the context window of this model. Please adjust your input and try again.
What is the expected behavior?
No response
What do you see instead?
Additional information
No response
For me running /compact fixes it
Consistently receiving this on my MacBook as well.
Same for me, can't even run compact.
Can confirm i am getting the same error consistently using codex + cursor 1.6.27 on mac.
I'm getting this error, it started it yesterday. any hope for fix?
I am also getting this error. I have tried resetting vs code, logging in and out of Codex and deleting config file but no change. I'm on Window 11 and haven't had this error until now.
same on macbook pro M4 and Macos 26
Hey all, is this an error you see within one long session and are you all re-using the same session over and over again? Wondering if you have tried to create a new chat or session and whether you still hit this issue when you do?
Here is the "new chat" button in vscode:
@tibo-openai
This happens even when i delete the history in ~/.codex/
Very strange, 200k Context used i get this disgusting error. Fix it ASAP! Unuseable, it does mvn test BAM ! i get the input too long error?!?! for 10k lines code project
And i think the people here talk about the CLI, not the extension in VS Code.
@tibo-openai This happens in both CLI and extension for me. And yes it's a long session where the context is consumed, but /compact doesn't work because I get the same error.
Sometimes if it's a big task, codex reaches the limit and just breaks midway. Not ideal. An auto-compact feature is needed like CC.
No fix but I get the same error now, was ok previously working on the same project with less complicated requests. /compact /clear or a new chat same problem.
Hey all, is this an error you see within one long session and are you all re-using the same session over and over again? Wondering if you have tried to create a new chat or session and whether you still hit this issue when you do?
Here is the "new chat" button in vscode:
Using latest CLI on MacBook, no current project/chat, fresh wipe of ~/.codex.
Hey all, is this an error you see within one long session and are you all re-using the same session over and over again? Wondering if you have tried to create a new chat or session and whether you still hit this issue when you do?
Here is the "new chat" button in vscode: Image
Yes. I'm on cli and I'm in the middle of debugging an issue. I would not want to switch to a new session. Coming from Claude Code I didn't have this problem before. There must be a way to work on a long session, no?
Hey all, is this an error you see within one long session and are you all re-using the same session over and over again? Wondering if you have tried to create a new chat or session and whether you still hit this issue when you do?
Here is the "new chat" button in vscode:
This is exactly what the problem is. Its "Full"
Hey all, is this an error you see within one long session and are you all re-using the same session over and over again? Wondering if you have tried to create a new chat or session and whether you still hit this issue when you do? Here is the "new chat" button in vscode:
This is exactly what the problem is. Its "Full"
I frequently hit this too, because I am using task master to guide the codex CLI to work on bigger scope of tasks, this can go on for hours. In claude code it auto compacts the context when it is full. I think people are looking for that auto compact feature.
+1, context meter says 57% left. This is terrible UX.
EDIT: macOS 15.4, codex 0.39.
same for me ! stream error: stream disconnected before completion: Your input exceeds the context window of this model. Its very annoying. Here i have to tell codex to work file local md files to not overload the context window. /compact forgets the previous conversation and codex needs to reanalyze the content... Switching back to Claude if now fix will be available....
Same problem here on macOS 26 and codex CLI v0.39.0. It is really weird coz most of the time it worked after a few (like 3~5) retries. It just won't work at the very first try.
I am using Codex CLI v0.39.0 and have encountered this issue in a new chat. My spending limits did not even reach 10%. The context meter says: '47.4K tokens used, 93% context left'