VSCode在WSL环境下无法使用Github Copilot(网络问题)
概要
本文记录了一个案例:VSCode 在 WSL 环境下无法使用 Github Copilot,但是原生 Windows 下使用没问题。
问题表现
使用 VsCode 连接到 WSL 后,Copilot 无法进行自动或手动补全,在聊天窗口输入信息后始终显示“正在准备 Copilot”。
使用 Ctrl+` 打开面板,点击“输出”面板,右上角选择"Github Copilot Chat",可以看到错误日志如下:
2025-09-03 15:54:27.648 [info] [GitExtensionServiceImpl] Initializing Git extension service. 2025-09-03 15:54:27.648 [info] Can't use the Electron fetcher in this environment. 2025-09-03 15:54:27.648 [info] Using the Node fetch fetcher. 2025-09-03 15:54:27.648 [info] [GitExtensionServiceImpl] Successfully activated the vscode.git extension. 2025-09-03 15:54:27.648 [info] [GitExtensionServiceImpl] Enablement state of the vscode.git extension: true. 2025-09-03 15:54:27.648 [info] [GitExtensionServiceImpl] Successfully registered Git commit message provider. 2025-09-03 15:54:28.580 [info] Logged in as focksor 2025-09-03 15:54:31.233 [info] Got Copilot token for focksor 2025-09-03 15:54:31.245 [info] activationBlocker from 'languageModelAccess' took for 3289ms 2025-09-03 15:54:31.396 [error] TypeError: fetch failed at node:internal/deps/undici/undici:13510:13 at processTicksAndRejections (node:internal/process/task_queues:105:5) at Lk._fetch (/home/focksor/.vscode-server/extensions/github.copilot-chat-0.30.3/dist/extension.js:1170:29745) at Ov._fetchModels (/home/focksor/.vscode-server/extensions/github.copilot-chat-0.30.3/dist/extension.js:2539:5015) Error: read ECONNRESET at TLSWr