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

Failed to list available models due to duplicate CA certificates from combined system and bundled certs

Open a1mersnow opened this issue 11 months ago • 28 comments

Describe the bug

whatever i ask, always show this error

Affected version

0.0.373 Commit: 1f9ed04

Steps to reproduce the behavior

No response

Expected behavior

No response

Additional context

No response

a1mersnow avatar Jan 02 '26 04:01 a1mersnow

Perhaps a corner case, but in my case there was a MTU limit hit as well.

To fix it:

sudo ip link set dev eth0 mtu 1300

And then test:

openssl s_client -connect api.business.githubcopilot.com:443

If you still don't get the SSL (notice 104 error code):

Connecting to 140.82.113.22
CONNECTED(00000003)
write:errno=104
---
no peer certificate available
---
No client certificate CA names sent
Negotiated TLS1.3 group: <NULL>
---
SSL handshake has read 0 bytes and written 1572 bytes
Verification: OK
---
New, (NONE), Cipher is (NONE)
Protocol: TLSv1.3
This TLS version forbids renegotiation.
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 0 (ok)
---

Reduce MTU until package fits

jlegido avatar Jan 08 '26 11:01 jlegido

@andyfeller I don't wanna hijack this conversation. But as you're having discussions with the team, I just wanted to bring this issue to your attention. I haven't confirmed anything yet, but I have a suspicion this issue also applies to VS Code as well.

Thanks for raising that issue to my attention, @fishcharlie 🙇 I've been digging into what VS Code experiences do around this, so it is serendipitous timing. 😅

What problem are we trying to solve in Copilot CLI?

The certificate changes in 0.0.370 were meant to let copilot work with proxies, requiring system certificates not in the Mozilla CA bundle that Node uses by default. The intent was to avoid users needing to deal with Node flags and env var knowledge.

What does VS Code and VS Code Copilot experiences do?

As you noticed, VS Code provides 2 options that users can control where CA certificates are sourced from:

				'http.systemCertificates': {
					type: 'boolean',
					default: true,
					markdownDescription: localize('systemCertificates', "Controls whether CA certificates should be loaded from the OS. On Windows and macOS, a reload of the window is required after turning this off. When during [remote development](https://aka.ms/vscode-remote) the {0} setting is disabled this setting can be configured in the local and the remote settings separately.", '`#http.useLocalProxyConfiguration#`'),
					restricted: true
				},
				'http.systemCertificatesNode': {
					type: 'boolean',
					tags: ['experimental'],
					default: systemCertificatesNodeDefault,
					markdownDescription: localize('systemCertificatesNode', "Controls whether system certificates should be loaded using Node.js built-in support. Reload the window after changing this setting. When during [remote development](https://aka.ms/vscode-remote) the {0} setting is disabled this setting can be configured in the local and the remote settings separately.", '`#http.useLocalProxyConfiguration#`'),
					restricted: true,
					experiment: {
						mode: 'auto'
					}
				},

These come into play in a few related projects:

  1. microsoft/vscode-proxy-agent
  2. microsoft/vscode
  3. microsoft/vscode-copilot-chat

How do we address this?

Removing those 2 certificates in my login keychain, fixed this issue.

Don't merge system certificates with bundled. Either:

  1. Use only bundled certificates, or
  2. Deduplicate by Subject before merging, preferring self-signed roots

Maybe just using bundled is the right choice, as the users with more advanced needs can use standard node envs.

@paolomainardi : My theory why these 2 self-signed certificates caused problems is because they broke the CA chain. I don't know if preferring self-signed certificates would have been the answer here since it took removing them to allow connections to be made.

I haven't confirmed anything yet, but I have a suspicion this issue also applies to VS Code as well. It'd be amazing to get a fix across everything.

@fishcharlie: Ideally I would like consistent behavior, but I also want to point out that GitHub Copilot CLI has a broader use case in automation than VS Code.

The microsoft/vscode-proxy-agent library provides a set of common tools for the different VS Code products. Looking at how it's used in microsoft/vscode and microsoft/vscode-copilot-chat, I'm not sure it does any deduplication or other filtering before overriding the TLS certificates. 🤔

andyfeller avatar Jan 08 '26 14:01 andyfeller

im having the same issue which means I am not able to use copilot-cli. is there any workaround for this? I do not have the same login certificates that paolomainardi mentions

psclkhoury avatar Jan 27 '26 19:01 psclkhoury

I also get the same error when I use @cli in the chat window of vscode.

psclkhoury avatar Feb 02 '26 15:02 psclkhoury

For me Homebrew update broke Node TLS trust. Copilot CLI failed with “unable to get issuer certificate”. Setting CA bundle fixed it:
export NODE_EXTRA_CA_CERTS="/opt/homebrew/etc/openssl@3/cert.pem" After that, Copilot CLI works again. Reinstalling ca-certificates/openssl@3 also helps.

Ayyoub-Ka avatar Feb 05 '26 11:02 Ayyoub-Ka

NODE_EXTRA_CA_CERTS works well, thank you!

NODE_EXTRA_CA_CERTS="/opt/homebrew/etc/openssl@3/cert.pem" copilot

peaceiris avatar Feb 18 '26 04:02 peaceiris

I tried the NODE_EXTRA_CA_CERTS and still doesn't work...

variable avatar Feb 25 '26 21:02 variable

This appears to be resolved as of GitHub Copilot CLI v1.0.103. Please update to that release or a newer stable version. We're closing this as completed. If it still happens, please comment with your version and reproduction steps.

copilot-cli-bot[bot] avatar Oct 23 '26 09:10 copilot-cli-bot[bot]