codex icon indicating copy to clipboard operation
codex copied to clipboard

stream disconnected before completion: stream closed before response.completed

Open GutterHiro opened this issue 1 year ago • 10 comments

What version of Codex is running?

codex-cli 0.44.0

Which model were you using?

all

What platform is your computer?

Windows 11 PRO

What steps can reproduce the bug?

Any prompt I send returns the following error:

⚠️ stream error: stream disconnected before completion: stream closed before response.completed; retrying 1/5 in 198ms…

I've tried everything—removing, reinstalling, running directly in the terminal and in an IDE through the extension—but I always get the same error.

Curiously, on my office computer—which is full of company restrictions—it runs fine, but on my personal computer, it doesn't.

Additional info: I'm using my personal account on the Plus plan.

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

GutterHiro avatar Sep 26 '25 15:09 GutterHiro

This has been a randomly occurring issue for me as well since around 0.30. i think its a api issue but after about 2-3 retries it finally goes through.

cpjet64 avatar Sep 26 '25 17:09 cpjet64

This has been a randomly occurring issue for me as well since around 0.30. i think its a api issue but after about 2-3 retries it finally goes through.

Unfortunately, that's not my case. To this day, on my personal PC, I haven't been able to get it to respond with a single comma—it always gives me the error I mentioned above. And my login process is the classic one through the portal, without using the API or anything like that.

GutterHiro avatar Sep 26 '25 20:09 GutterHiro

This bug is back in 0.42.0 on MacOs , it was fixed in the last few versions. Same place as well 30% context remaining, then:

⚠️ 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 194ms…

tekn0x avatar Sep 27 '25 01:09 tekn0x

Experiencing this issue since yesterday 9 PM CEST. VS Code with Codex Extension, Version 0.4.15 & 0.5.15

stream disconnected before completion: Your input exceeds the context window of this model. Please adjust your input and try again.

Changed models (gpt-5-codex-medium to low and gpt-5-minimal), switched mode from Agent to Chat.. nothing works. Limit is not exceeded

Lee4451 avatar Sep 28 '25 08:09 Lee4451

Experiencing this issue since yesterday 9 PM CEST. VS Code with Codex Extension, Version 0.4.15 & 0.5.15

stream disconnected before completion: Your input exceeds the context window of this model. Please adjust your input and try again.

Changed models (gpt-5-codex-medium to low and gpt-5-minimal), switched mode from Agent to Chat.. nothing works. Limit is not exceeded

This is a completely separate issue. AFAIK theree isnt a compact command for the extension so when this happens to to I just start a new conversation though now that I think about it you might be able to look for the conversation ID and then use codex-cli to /compact the conversation. I haven't tried but it might be worth experimenting with.

cpjet64 avatar Sep 28 '25 14:09 cpjet64

Adding for context, I encountered the same error message as the original post. The first two times I attempted to send through a request, I received the first error:

stream error: stream disconnected before completion: stream closed before response.completed

On the third attempt, it responded with:

stream disconnected before completion: Your input exceeds the context window of this model. Please adjust your input and try again.

A new chat resolved the issue - not sure why it took a 3 attempts to return the actual issue.

notarikon-nz avatar Oct 03 '25 01:10 notarikon-nz

Adding for context, I encountered the same error message as the original post. The first two times I attempted to send through a request, I received the first error:

stream error: stream disconnected before completion: stream closed before response.completed

On the third attempt, it responded with:

stream disconnected before completion: Your input exceeds the context window of this model. Please adjust your input and try again.

A new chat resolved the issue - not sure why it took a 3 attempts to return the actual issue.

I wish I had your luck, I did another test here and I only get disconnection. Since the launch, I haven’t been able to use Codex even once. When it gets out of beta, I’ll give it another chance. I went back to Claude Code this month.

GutterHiro avatar Oct 03 '25 01:10 GutterHiro

+1

timothee-aubourg avatar Oct 04 '25 14:10 timothee-aubourg

I ran into this issue when I ran /compact quite close to the context window's limit, and it looked like it succeeded (and showed 100% context available), but then every follow on message had the stream closed error.

Resuming the session again showed the 100% context, but then I tried to run /compact again, and it shot back to 0%.

Resuming the session a second time, then showed 0% context, and the error persisted.

This happened on 0.45 -> 0.50.

Would be nice if we could "clean" the context a bit manually in these situations, for now we can extract some of the "lost" context via ~/.codex/sessions if we're desperate.

Note: New sessions work as expected.

jumploops avatar Oct 28 '25 22:10 jumploops

I'm going to close this issue because there's not enough information to repro or diagnose. If this happens again, please use the /feedback slash command to upload the session and post a thread ID.

etraut-openai avatar Nov 26 '25 08:11 etraut-openai