“Error while fetching extensions. XHR failed” means VS Code asked the extension marketplace for a list and the request did not get through. VS Code itself is fine; something between it and the marketplace — a proxy, a corporate certificate, a firewall rule, a DNS problem — is in the way. The error text is unhelpful, but the causes are few and each has a quick test.
Step 1: what is the real error?#
Open Help, Toggle Developer Tools, then the Console tab, and reload the Extensions view. The XHR failure is logged with a cause: ECONNREFUSED, ENOTFOUND, CERT_HAS_EXPIRED, self signed certificate in certificate chain, 407 Proxy Authentication Required. Each points to a different section below.
Step 2: can the machine reach the marketplace?#
curl -I https://marketplace.visualstudio.com
curl -I https://update.code.visualstudio.com
curl -I https://vscode.blob.core.windows.net
Run these from a terminal. If they fail too, the problem is the network, not VS Code, and the fix is on the network side: a firewall exception for those domains, plus *.gallerycdn.vsassets.io and *.vscode-unpkg.net, which serve extension packages. The official documentation lists the complete set.
If curl works and VS Code does not, VS Code is not using the same network settings as your shell — usually a proxy configured in one place and not the other.
Proxies#
VS Code reads proxy settings from, in order: its own http.proxy setting, then the HTTP_PROXY and HTTPS_PROXY environment variables, then the operating system’s proxy configuration. A mismatch between these is the most common cause on corporate machines.
{
"http.proxy": "http://proxy.example.com:8080",
"http.proxyAuthorization": null,
"http.proxySupport": "on"
}
If the proxy needs a username and password, the URL form is http://user:[email protected]:8080. A 407 in the console means authentication is required and not being sent.
Launch VS Code from a terminal where the proxy variables are set, so it inherits them:
export HTTPS_PROXY=http://proxy.example.com:8080
code .
Set "http.proxySupport": "off" to test whether the proxy is the problem at all; if extensions load without it, the proxy configuration is wrong.
Certificates#
Corporate networks often inspect HTTPS traffic by re-signing it with their own certificate. Browsers trust it because the organisation installed the root certificate; VS Code’s built-in network stack may not. The console error mentions a self-signed certificate or an unknown issuer.
The right fix is telling VS Code to use the system certificate store, which is the default in current versions:
{ "http.systemCertificates": true }
If that is already on and the error persists, the root certificate is not installed at the OS level; get it from whoever runs the network and install it in the system store. As a last resort for diagnosis only:
{ "http.proxyStrictSSL": false }
That disables certificate checking for VS Code’s requests. If it makes the Extensions view work, you have confirmed a certificate problem; turn it back on once the real certificate is installed.
DNS and VPN#
ENOTFOUND means the marketplace hostname did not resolve. Check whether a VPN is up and whether it routes all traffic through a network that blocks the domains; try with the VPN off. Some security software replaces DNS and blocks CDN hosts by policy.
Other causes#
- A stale cache. Quit VS Code and delete the
CachedExtensionVSIXsfolder under the user data directory (%APPDATA%\Codeon Windows,~/.config/Codeon Linux,~/Library/Application Support/Codeon macOS). - An old VS Code. Marketplace API changes occasionally break very old versions. Update.
- A fork. VSCodium and similar use the Open VSX registry rather than Microsoft’s marketplace; a product.json pointing at the wrong one produces this error.
- Time and date wrong. A clock far off makes every certificate invalid.
Installing from a file#
When the network cannot be fixed today, download the extension’s .vsix file from the marketplace website on a machine that can reach it, then install it:
code --install-extension ms-python.python-2026.1.0.vsix
Or in the Extensions view, the … menu has Install from VSIX. Dependencies are not resolved automatically this way; install each extension pack member separately.
Questions people ask#
Extensions load but installation fails.
Listing and downloading use different domains. Add the CDN hosts, *.gallerycdn.vsassets.io and *.vscode-unpkg.net, to whatever allowlist the marketplace domain is on.
It worked yesterday.
A VPN, a network change, an expired certificate, or a proxy password that changed. The console error tells you which.
Does this affect Settings Sync and updates too?
Often, since they use related domains. Fixing the proxy or certificate fixes all of them at once.
Can I use VS Code fully offline?
Yes, with extensions installed from VSIX files. Everything except the marketplace, updates and sync works without a network.
Where to go next#
- VS Code extensions not working — when they install but do not run.
- VS Code extensions worth installing — once the view loads.
- GitHub Copilot not working — the same network causes, different symptom.