codex icon indicating copy to clipboard operation
codex copied to clipboard

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

Open bharat-savaliya-altera opened this issue 10 months ago • 11 comments

What version of Codex is running?

0.87.0

What subscription do you have?

Enterprise

Which model were you using?

gpt5

What platform is your computer?

Microsoft Windows NT 10.0.26100.0 x64

What terminal emulator and version are you using (if applicable)?

No response

What issue are you seeing?

■ stream disconnected before completion: stream closed before response.completed'

above message is coming when execution is in progress.. it stops. we have to prompt "continue" to proceed

What steps can reproduce the bug?

Uploaded thread: 019be04b-ed14-75a3-87e0-44814acd1149

What is the expected behavior?

No response

Additional information

No response

bharat-savaliya-altera avatar Jan 27 '26 13:01 bharat-savaliya-altera

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #9936
  • #9635
  • #9727
  • #9830

Powered by Codex Action

github-actions[bot] avatar Jan 27 '26 13:01 github-actions[bot]

Thanks for uploading the logs. I don't see any smoking guns in the logs.

This looks to me like a vanilla networking connectivity issue. Are you using Codex on a corporate network? If so, I recommend working with your IT team to investigate issues with routing, proxies, firewalls, etc.

etraut-openai avatar Jan 27 '26 18:01 etraut-openai

This worked for me:

The issue was a stale, cached authentication session in the local config (it was prioritizing an old/limited API Org instead of my ChatGPT subscription).

  1. Kill lingering processes and remove the cached auth file:
pkill -f codex
rm ~/.codex/auth.json
  1. Start fresh (forcing no env vars to ensure a clean login):
env -u OPENAI_API_KEY -u OPENAI_ORGANIZATION codex
  1. Select "Sign in with ChatGPT" when prompted.

Lmk if it also works for you or helps?

ahmed-ela avatar Jan 28 '26 04:01 ahmed-ela

here is a new one. Or mention your thread ID 019c13b5-b3e2-74b2-aa13-f351fb90a614 in an existing issue. thank you! great stuff codex, I like it more than claude code :)). for now.

ibabencu avatar Jan 31 '26 12:01 ibabencu

@ibabencu, thanks for uploading your logs. That error occurred because you tripped a server-side check that blocks conversations that are considered unsafe. I don't see anything in your prompt that would be an obvious cyber risk or similar, so this was likely a false positive. We're always working to better tune these safety detectors. If you see other instances of this, please use /feedback to upload the session details. We make use of this data to improve the models and detectors.

etraut-openai avatar Jan 31 '26 17:01 etraut-openai

I've uploaded a /feedback, thread ID 019c2dad-c1c0-7331-bb4b-0e19534b637a.

atimmer avatar Feb 05 '26 13:02 atimmer

[like] Ionut Babencu reacted to your message:


From: Anton Timmermans @.> Sent: Thursday, February 5, 2026 1:53:40 PM To: openai/codex @.> Cc: Ionut Babencu @.>; Mention @.> Subject: Re: [openai/codex] Error: stream disconnected before completion: stream closed before response.completed (Issue #9995)

[https://avatars.githubusercontent.com/u/584693?s=20&v=4]atimmer left a comment (openai/codex#9995)https://github.com/openai/codex/issues/9995#issuecomment-3853814382

I've uploaded a /feedback, thread ID 019c2dad-c1c0-7331-bb4b-0e19534b637a.

— Reply to this email directly, view it on GitHubhttps://github.com/openai/codex/issues/9995#issuecomment-3853814382, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWJOXJ35N7GCTCYN3BZBUQL4KNDOJAVCNFSM6AAAAACTBH6276VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTQNJTHAYTIMZYGI. You are receiving this because you were mentioned.Message ID: @.***>

ibabencu avatar Feb 05 '26 15:02 ibabencu

@atimmer, thanks for uploading your logs. I looked at them, and I suspect the issue you're hitting is due to very long tool outputs. We'll need to look into it further. In the meantime, as a potential workaround, try to reframe the task or adjust your skills / MCPs so the output of tool calls is smaller.

etraut-openai avatar Feb 05 '26 17:02 etraut-openai

Using the VSCode plugin, I logged out by clicking the settings cog icon at the top of the view and logged back in

lamellama avatar Mar 18 '26 15:03 lamellama

I kept running into this on Azure with gpt-5.3-codex and 5.4. Built a workaround that auto-retries on stream disconnect and splits large tasks into separate sessions to avoid context overflow and compaction errors. https://github.com/pauldinu10/codex-smart It's a PowerShell wrapper that runs each task from a tasks.md file as a fresh codex exec --full-auto session. If the stream drops, it retries automatically up to N times. Not a fix, but makes Codex usable for long migrations.

pauldinu10 avatar Mar 23 '26 22:03 pauldinu10

stream disconnected before completion: stream closed before response.completed

PZ123CLI avatar Jun 20 '26 13:06 PZ123CLI