VScode插件Codex在wsl中Ubuntu系统超时:Reconnecting,stream disconnected before completion: error sending request for url (https://chatgpt.
What version of Codex is running?
codex-cli 0.77.0
What subscription do you have?
Plus
Which model were you using?
gpt-4.2
What platform is your computer?
Windows系统中的wslUbuntu20.04中的vscode插件Codex
What issue are you seeing?
2026-01-07 16:54:08.510 [warning] [warn] is production release true warning false
2026-01-07 16:54:12.914 [error] Error fetching https://ab.chatgpt.com/v1/initialize?k=client-sYWqzCYMRkUg4DqqiZcR5DGTNl2iD7zNJY0HoeDLzxR&st=javascript-client&sv=3.27.0&t=1767776050766&sid=1ad383c1-b06a-4503-8ed2-f1b8bedee5c2&se=1: TypeError: fetch failed
2026-01-07 16:54:12.932 [error] Error fetching /wham/accounts/check: TypeError: fetch failed
2026-01-07 16:54:13.014 [error] Error fetching https://ab.chatgpt.com/v1/initialize?k=client-sYWqzCYMRkUg4DqqiZcR5DGTNl2iD7zNJY0HoeDLzxR&st=javascript-client&sv=3.27.0&t=1767776050554&sid=1ad383c1-b06a-4503-8ed2-f1b8bedee5c2&se=1: TypeError: fetch failed
2026-01-07 16:54:13.126 [error] Error fetching https://ab.chatgpt.com/v1/initialize?k=client-sYWqzCYMRkUg4DqqiZcR5DGTNl2iD7zNJY0HoeDLzxR&st=javascript-client&sv=3.27.0&t=1767776050551&sid=1ad383c1-b06a-4503-8ed2-f1b8bedee5c2&se=1: TypeError: fetch failed
2026-01-07 16:54:15.058 [error] Error fetching /wham/tasks/list?limit=20&task_filter=current: TypeError: fetch failed
2026-01-07 16:54:15.289 [error] Error fetching /wham/accounts/check: TypeError: fetch failed
2026-01-07 16:54:15.417 [error] Error fetching /wham/environments: TypeError: fetch failed
2026-01-07 16:54:15.519 [error] Error fetching /wham/usage: TypeError: fetch failed
2026-01-07 16:54:18.060 [error] [CodexMcpConnection] CLI: codex_api::endpoint::responses: error=network error: error sending request for url (https://chatgpt.com/backend-api/codex/responses)
2026-01-07 16:54:18.060 [warning] [CodexMcpConnection] CLI: codex_core::codex: stream disconnected - retrying turn (1/5 in 207ms)...
2026-01-07 16:54:21.249 [error] [CodexMcpConnection] CLI: codex_api::endpoint::responses: error=network error: error sending request for url (https://chatgpt.com/backend-api/codex/responses)
2026-01-07 16:54:21.250 [warning] [CodexMcpConnection] CLI: codex_core::codex: stream disconnected - retrying turn (2/5 in 419ms)...
2026-01-07 16:54:22.618 [error] Error fetching https://ab.chatgpt.com/v1/rgstr?k=client-sYWqzCYMRkUg4DqqiZcR5DGTNl2iD7zNJY0HoeDLzxR&st=javascript-client-react&sv=3.27.0&t=1767776060553&sid=1ad383c1-b06a-4503-8ed2-f1b8bedee5c2&ec=13&gz=1: TypeError: fetch failed
2026-01-07 16:54:24.961 [error] [CodexMcpConnection] CLI: codex_api::endpoint::responses: error=network error: error sending request for url (https://chatgpt.com/backend-api/codex/responses)
2026-01-07 16:54:24.961 [warning] [CodexMcpConnection] CLI: codex_core::codex: stream disconnected - retrying turn (3/5 in 817ms)...
2026-01-07 16:54:28.847 [error] [CodexMcpConnection] CLI: codex_api::endpoint::responses: error=network error: error sending request for url (https://chatgpt.com/backend-api/codex/responses)
2026-01-07 16:54:28.847 [warning] [CodexMcpConnection] CLI: codex_core::codex: stream disconnected - retrying turn (4/5 in 1.642s)...
2026-01-07 16:54:33.568 [error] [CodexMcpConnection] CLI: codex_api::endpoint::responses: error=network error: error sending request for url (https://chatgpt.com/backend-api/codex/responses)
2026-01-07 16:54:33.569 [warning] [CodexMcpConnection] CLI: codex_core::codex: stream disconnected - retrying turn (5/5 in 2.926s)...
2026-01-07 16:54:39.548 [error] [CodexMcpConnection] CLI: codex_api::endpoint::responses: error=network error: error sending request for url (https://chatgpt.com/backend-api/codex/responses)
What steps can reproduce the bug?
2026-01-07 16:54:08.510 [warning] [warn] is production release true warning false
2026-01-07 16:54:12.914 [error] Error fetching https://ab.chatgpt.com/v1/initialize?k=client-sYWqzCYMRkUg4DqqiZcR5DGTNl2iD7zNJY0HoeDLzxR&st=javascript-client&sv=3.27.0&t=1767776050766&sid=1ad383c1-b06a-4503-8ed2-f1b8bedee5c2&se=1: TypeError: fetch failed
2026-01-07 16:54:12.932 [error] Error fetching /wham/accounts/check: TypeError: fetch failed
2026-01-07 16:54:13.014 [error] Error fetching https://ab.chatgpt.com/v1/initialize?k=client-sYWqzCYMRkUg4DqqiZcR5DGTNl2iD7zNJY0HoeDLzxR&st=javascript-client&sv=3.27.0&t=1767776050554&sid=1ad383c1-b06a-4503-8ed2-f1b8bedee5c2&se=1: TypeError: fetch failed
2026-01-07 16:54:13.126 [error] Error fetching https://ab.chatgpt.com/v1/initialize?k=client-sYWqzCYMRkUg4DqqiZcR5DGTNl2iD7zNJY0HoeDLzxR&st=javascript-client&sv=3.27.0&t=1767776050551&sid=1ad383c1-b06a-4503-8ed2-f1b8bedee5c2&se=1: TypeError: fetch failed
2026-01-07 16:54:15.058 [error] Error fetching /wham/tasks/list?limit=20&task_filter=current: TypeError: fetch failed
2026-01-07 16:54:15.289 [error] Error fetching /wham/accounts/check: TypeError: fetch failed
2026-01-07 16:54:15.417 [error] Error fetching /wham/environments: TypeError: fetch failed
2026-01-07 16:54:15.519 [error] Error fetching /wham/usage: TypeError: fetch failed
2026-01-07 16:54:18.060 [error] [CodexMcpConnection] CLI: codex_api::endpoint::responses: error=network error: error sending request for url (https://chatgpt.com/backend-api/codex/responses)
2026-01-07 16:54:18.060 [warning] [CodexMcpConnection] CLI: codex_core::codex: stream disconnected - retrying turn (1/5 in 207ms)...
2026-01-07 16:54:21.249 [error] [CodexMcpConnection] CLI: codex_api::endpoint::responses: error=network error: error sending request for url (https://chatgpt.com/backend-api/codex/responses)
2026-01-07 16:54:21.250 [warning] [CodexMcpConnection] CLI: codex_core::codex: stream disconnected - retrying turn (2/5 in 419ms)...
2026-01-07 16:54:22.618 [error] Error fetching https://ab.chatgpt.com/v1/rgstr?k=client-sYWqzCYMRkUg4DqqiZcR5DGTNl2iD7zNJY0HoeDLzxR&st=javascript-client-react&sv=3.27.0&t=1767776060553&sid=1ad383c1-b06a-4503-8ed2-f1b8bedee5c2&ec=13&gz=1: TypeError: fetch failed
2026-01-07 16:54:24.961 [error] [CodexMcpConnection] CLI: codex_api::endpoint::responses: error=network error: error sending request for url (https://chatgpt.com/backend-api/codex/responses)
2026-01-07 16:54:24.961 [warning] [CodexMcpConnection] CLI: codex_core::codex: stream disconnected - retrying turn (3/5 in 817ms)...
2026-01-07 16:54:28.847 [error] [CodexMcpConnection] CLI: codex_api::endpoint::responses: error=network error: error sending request for url (https://chatgpt.com/backend-api/codex/responses)
2026-01-07 16:54:28.847 [warning] [CodexMcpConnection] CLI: codex_core::codex: stream disconnected - retrying turn (4/5 in 1.642s)...
2026-01-07 16:54:33.568 [error] [CodexMcpConnection] CLI: codex_api::endpoint::responses: error=network error: error sending request for url (https://chatgpt.com/backend-api/codex/responses)
2026-01-07 16:54:33.569 [warning] [CodexMcpConnection] CLI: codex_core::codex: stream disconnected - retrying turn (5/5 in 2.926s)...
2026-01-07 16:54:39.548 [error] [CodexMcpConnection] CLI: codex_api::endpoint::responses: error=network error: error sending request for url (https://chatgpt.com/backend-api/codex/responses)
2026-01-07 16:55:23.442 [error] Error fetching https://ab.chatgpt.com/v1/rgstr?k=client-sYWqzCYMRkUg4DqqiZcR5DGTNl2iD7zNJY0HoeDLzxR&st=javascript-client-react&sv=3.27.0&t=1767776121335&sid=1ad383c1-b06a-4503-8ed2-f1b8bedee5c2&ec=13&gz=1: TypeError: fetch failed
What is the expected behavior?
_No response_
Additional information
参考
https://github.com/openai/codex/issues/7623
问题如下
Reconnecting... 1/5
Reconnecting... 2/5
Reconnecting... 3/5
Reconnecting... 4/5
Reconnecting... 5/5
stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses)
解决办法
在 vscode 设置中搜索 http.proxy,然后输入你的代理地址:http://192.168.0.253:7890/
补充:这个代理是 vscode 全局的,若影响到了你的正常使用,需要回到这里进行删除
代理地址是如何来的
Clash for Windows 中有一个允许局域网其他设备代理到这台主机上,所以将我的 Windows 主机作为了代理服务器,我的主机外网卡 IP 是这个,使用 ipconfig进行查看,每个电脑使用的外网卡是不一样的,我这里是使用的网线,如果你是 WiFi 可以会不一样的
15 Comments
I also have the same error on my Macbook.
This error message indicates a networking connectivity issue. Are you able to repro the problem reliably, or is it intermittent?
I solved the problem by forwarding the proxy used by the plugin to my local machine.
Do you have steps to do that?
我使用"全局代理"模式可以正常使用, 但是PAC模式不行. 大概率还是PAC配置问题.
I can use it normally in 'Global Proxy' mode, but it doesn't work in PAC mode. Most likely, it's still a PAC configuration issue.
不好意思,我现在才看到消息,这个是稳定出现的问题,但是我使用的是vscode插件中的codex,在Windows中的wsl2创建的Ubuntu系统,然后ssh远程登录到这个Ubuntu系统会出现这个网络问题,但是通过vscode里面代理目标中转地址为Windows机地址就行了
Translation of previous response to English: Sorry, I only just saw your message. This is an issue that occurs consistently. I’m using Codex through the VS Code plugin, running on an Ubuntu system created in WSL2 on Windows. When I SSH remotely into that Ubuntu system, this network problem occurs. However, it works if I set the proxy target relay address in VS Code to the Windows machine’s address.
OK, so this is a network configuration problem. Thanks for confirming.
你好,我想询问一下,因为网络问题导致收到OpenAI警告,然后plus会员被收回了,我进行申述的话,还能找回吗?
Sorry, I don't know the answer to that. You would need to contact OpenAI customer support.
好的,感谢您
我的情况是:windows-os可以直接登录codex,并进行聊天。
但是在wsl里面无法登录,也无法聊天。
这确实是网络通讯的问题。
按照这个图片进行配置,并设置为全局代理。
<img width="1052" height="752" alt="Image" src="https://github.com/user-attachments/assets/11ca4cb7-9314-4b89-91ff-8a1a04cfb78f" />
但我需要额外通过在wsl的.bashrc文件中增加如下的代理:
`# 设置 Clash 代理
export http_proxy="http://127.0.0.1:7890"
export https_proxy="http://127.0.0.1:7890"
export no_proxy="localhost,127.0.0.1,::1"`
最终,我通过
curl -I https://chatgpt.com进行测试,如果显示HTTP/1.1 200 Connection established,就说明是配置成功了解决了!
我的问题是:User 的 Http: Proxy 和 Remote 的 Http: Proxy 是有冲突的,最初我的 User 是 http://127.0.0.1:7897,在 Remote 中设置成我的 WSL 虚拟网关 IP http://172.28.128.1:7897,这两个同时存在是有冲突的,一直 Reconnecting...
看了楼主的做法直接用 http://172.28.128.1:7897 覆盖 User 原来的 http://127.0.0.1:7897,成功了。如果 User 留空,Remote 设成 http://172.28.128.1:7897,也可以成功,就是不要冲突。
其他前置设置:TUN模式,开启局域网连接,使用 “code .” 从 WSL 打开 vscode
确实就是代理的问题。我本来一直用的是clash for windows(默认端口7890),但最近切换到到了 clash verge(默认端口7897),而vscode的设置中的代理不会自动切换到7897,而是一直都是7890,需要手动切换到7897端口。
Fix: Codex and Claude Code not working in VS Code Remote WSL when VPN is enabled
Context
I was using:
Both Codex and Claude Code worked correctly without the VPN.
As soon as the VPN was enabled, both tools started failing inside WSL / VS Code Remote WSL.
---
Symptoms
Codex error
Codex failed with errors like:
The Codex conversation could not start properly.
Claude Code error
Claude Code failed with errors like:
At first, it looked like an OpenAI / Anthropic / VS Code extension issue, but it was actually caused by WSL2 networking with the VPN.
---
Diagnosis
From Windows PowerShell, with the VPN enabled, the Codex endpoints were reachable:
Both returned:
This
405is expected because those endpoints expectPOST, notHEAD.The important part is that Windows could reach the endpoints through the VPN.
However, from WSL2, the tools were failing or timing out when the VPN was enabled.
So the real issue was:
---
Root cause
The issue was caused by the default WSL2 NAT networking mode interacting badly with the Windows VPN.
With the VPN enabled:
The problem was not Codex itself, Claude Code itself, or VS Code itself.
The problem was the WSL2 networking mode.
---
Fix
Create or edit this Windows file:
Add the following configuration:
Then fully restart WSL:
After restarting WSL, test the Codex endpoints inside WSL:
Expected output:
Again,
405is fine here. It proves that the endpoints are reachable from WSL.After enabling WSL2 mirrored networking, both Codex and Claude Code worked again with the VPN enabled.
---
Codex installation note
If
codexis not installed inside WSL, install it with npm, not snap.Check Node and npm:
Install Codex:
Verify:
Then log in and test:
Avoid installing Codex with snap in this setup:
In my case, installing Codex through npm worked correctly after fixing WSL networking.
---
Final summary
The issue was:
The fix was to enable WSL2 mirrored networking:
Then restart WSL:
After switching WSL2 to mirrored networking, WSL used the VPN path correctly and Codex / Claude Code worked again inside VS Code Remote WSL with the VPN enabled.