copilot-cli icon indicating copy to clipboard operation
copilot-cli copied to clipboard

"Connection error." with CAPIError in the logs

Open mfronczyk opened this issue 3 months ago • 17 comments

Describe the bug

I use Copilot in enterprise environment. I switched to Node 24.9 so that it respects my proxy settings and I logged in successfully. However, when I enter any prompt, it thinks for a while and then I get the following error:

Model call failed: "Connection error." Execution failed: Connection error.

In the copilot logs I see:

Failed to list models: Forbidden {"name": "CAPIError" }

Can you help me understand whether:

  1. Does the above mean that Copilot CLI is disabled for my organization
  2. Or not necessarily, but the proxy blocks connection to copilot CLI api?
  3. Something else?

Affected version

0.0.328

Steps to reproduce the behavior

  1. Type 'copilot'
  2. Enter "How are you today?"

Expected behavior

I'd like to know how to distinguish an error caused by Copilot CLI being disabled in my organisation vs network connection error so that I get a clue how to resolve it.

Additional context

  • Operating system - Windows

mfronczyk avatar Sep 29 '25 09:09 mfronczyk

I've enabled the Copilot CLI policy and it still doesn't work. ~~I'm betting on 2.~~ Not a proxy issue either.

JGalego avatar Sep 29 '25 12:09 JGalego

There is an open issue to support proxies: https://github.com/github/copilot-cli/issues/41

However, "Forbidden" makes me suspicious that this is a 4xx error. Flagging this for the team to look at

RyanHecht avatar Sep 29 '25 21:09 RyanHecht

✅ Tested version 0.0.330 with node 22.11.0 and 24.9.0

JGalego avatar Sep 30 '25 10:09 JGalego

✅ Re-ran the CLI on a Mac (no version upgrade) and it also worked Can this be a delay between enabling the Copilot CLI policy and it actually taking effect?

JGalego avatar Sep 30 '25 16:09 JGalego

I updated to 0.0.331. I observe now the following:

  1. When I type /model, the tool very often crashes with ERROR: No supported model available. However it showed me a list of models available a couple of times. But the list of models was different than I see in VS Code, so I'm wondering where it came from?
  2. When I finally managed to select a model which I don't have in VS Code (e.g. gpt-5), I get error fetch failed
  3. When I changed the model to 'claude-sonnet-4' which I have in VS Code, I get a different error Connection error.

I'm not sure how to progress. What my company needs to enable in GitHub to make it work exactly? Is it:

  • GitHub CLI
  • MCP

It all works fine when I use VS Code, Visual Studio or Pycharm. Does Copilot CLI use a different API than these tools?

mfronczyk avatar Oct 01 '25 14:10 mfronczyk

+1 that 0.0.331 gets ERROR: No supported model available which works in 0.0.330

node version: 22.17.1

ins429 avatar Oct 01 '25 19:10 ins429

how to distinguish an error caused by Copilot CLI being disabled in my organization

Check the setting of Copilot CLI in Copilot page.

ChrisTorng avatar Oct 03 '25 00:10 ChrisTorng

I'm using Copilot CLI 0.0.333 (installed by npm i -g @github/[email protected], copilot --version shows 0.0.330) + Node.js 24.9.0 with NODE_USE_ENV_PROXY=1 behind corporate proxy. It login successfully on WSL/Windows. But still can't send message due to this problem. And using proxychains4 on WSL is OK. I think the proxy support problem is not totally solved.

ChrisTorng avatar Oct 03 '25 00:10 ChrisTorng

npm i -g @github/[email protected], copilot --version shows 0.0.33

That looks like the npm update might not have worked correctly. Can you try npm i -g @github/copilot again? You should see the latest version (currently 0.0.333)

devm33 avatar Oct 03 '25 00:10 devm33

$ npm i -g @github/copilot

added 22 packages, and changed 11 packages in 5s

23 packages are looking for funding
  run `npm fund` for details
$ copilot --version
0.0.330
Commit: a8bfefe

I did this at first, found that the version is still 0.0.330. I had checked npm @github/copilot - Versions that shown 0.0.333 as latest. Then tried @0.0.333 to make sure it's the specific version. And I also tried @0.0.334 failed, but @0.0.334-1 succeeded. But the versions were all 0.0.330. I guess that it's the CLI itself not showing the correct version number.

I can't find the commit hash a8bfefe on Releases or even Commits. I don't know where it comes from.

ChrisTorng avatar Oct 03 '25 01:10 ChrisTorng

@ChrisTorng maybe there's some disconnect between npm i and what copilot is linked to. Can you check which copilot?

devm33 avatar Oct 03 '25 02:10 devm33

I shutdown WSL (wsl --shutdown), then get into Ubuntu again. The copilot --version is now 0.0.333 (without reinstall). The error of sending message is now ✗ Execution failed: fetch failed, as issue #115 Copilot CLI shows Error when submit any request: TypeError: fetch failed; Execution failed: fetch failed.

ChrisTorng avatar Oct 03 '25 02:10 ChrisTorng

I checked Node.js version again, it's 22.20.0. I don't know why. I'm sure that it was 24.9.0 previously before WSL restart. After install with nvm install --latest-npm again, it's 24.9.0. And copilot is working well now! I don't know why. Maybe sometimes it's using Windows's Node.js? And I did update Windows's Node.js previously (without restart Windows). And Windows version is working too. Thanks for helps.

ChrisTorng avatar Oct 03 '25 02:10 ChrisTorng

+1 similar issue on Mac, same error in the logs. Fresh install of 0.0.337 (first time install), connection errors, downgraded to 0.0.330 and it works now. Business account. Maybe interesting, 0.337/broken tried to connect to GH MCP at https://api.individual.githubcopilot.com/mcp/readonly, whereas 0.330/working (correctly, for me) uses https://api.business.githubcopilot.com/mcp/readonly.

mikewaters avatar Oct 09 '25 18:10 mikewaters

@mikewaters are you still experiencing this? Can you share a screenshot on CLI startup? It makes sense that you would be getting an error if you are using a business account but the request is going to api.individual.githubcopilot.com, but the question is why are you getting that URL? Would be interested to know which user the CLI thinks you are acting as.

williammartin avatar Oct 16 '25 09:10 williammartin

FWIW @andyfeller and I worked on improving logs for this specific issue. Hopefully landing in a release soon so we can gather more info about the underlying problem.

sergiou87 avatar Oct 20 '25 15:10 sergiou87

@sergiou87 downgrade to 0.0.330 fixes the issue, so diff may be helpful. Copilot subscription enabled by the org for personal account.

nikalaew avatar Oct 21 '25 22:10 nikalaew