Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Next.js and React

VS Code cannot load or install extensions: XHR failed

ErrorXHR failed

Short answer

XHR failed means VS Code could not reach the Visual Studio Marketplace over the network. Check that the Marketplace hostnames are reachable from your machine, then set the proxy VS Code should use, and add your proxy's certificate to the operating system trust store. If the network cannot be changed, install the extension from a downloaded VSIX file.

  • Applies to VS Code stable, Windows 11, macOS 15, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Test the Marketplace host from the same machine and network VS Code uses. If this fails or hangs, the problem is the network, not the extension.

    curl -I https://marketplace.visualstudio.com
  2. 2Match what you see, then jump to its fix

    1. 1The curl test times out or is refused, and other sites loadA firewall or filter blocks the Marketplace hostnamesFix
    2. 2connect ETIMEDOUT in the log, and the browser on the same machine works only through a proxyYour connection goes through a proxy that VS Code does not know aboutFix
    3. 3The failure only appears behind a company proxy, and certificate errors show in the log or in other toolsThe proxy re-signs HTTPS traffic with a certificate VS Code does not trustFix
    4. 4Marketplace stays unreachable and you need one extension nowThe network cannot be fixed: install from a VSIX fileFix

What does the error look like?

  • XHR failed
  • Extensions view stays empty or shows no results for any search
  • connect ETIMEDOUT

Cause 1 of 4

A firewall or filter blocks the Marketplace hostnames

1Check

VS Code needs several hostnames for the Marketplace and its downloads: marketplace.visualstudio.com, *.gallery.vsassets.io, *.gallerycdn.vsassets.io and vsmarketplacebadges.dev, plus update.code.visualstudio.com and *.vscode-cdn.net for updates. Test one of the gallery hosts as well.

curl -I https://marketplace.visualstudio.com/

2Fix

Ask whoever runs the network to allow those hostnames over HTTPS, or move to a network that does.

marketplace.visualstudio.com
*.gallery.vsassets.io
*.gallerycdn.vsassets.io
vsmarketplacebadges.dev

3Verify

Reload VS Code and search the Extensions view again.

code --list-extensions

Confirmed by code.visualstudio.com

Did this fix it?

Cause 2 of 4

Your connection goes through a proxy that VS Code does not know about

1Check

VS Code uses the same proxy support as Chromium and normally picks up system settings. Extensions and the command-line interface use the http.proxy setting instead. Open Settings and search for proxy.

env | grep -i proxy

2Fix

Set the proxy address in the http.proxy setting (or start VS Code with the --proxy-server option), then restart VS Code.

// settings.json
{
  "http.proxy": "http://proxy.example.com:8080"
}

3Verify

Restart VS Code and open the Extensions view.

code --list-extensions

Confirmed by code.visualstudio.com

Did this fix it?

Cause 3 of 4

The proxy re-signs HTTPS traffic with a certificate VS Code does not trust

1Check

Proxies that inspect HTTPS use their own certificate authority. VS Code rejects it unless the operating system trusts it.

curl -v https://marketplace.visualstudio.com 2>&1 | grep -i -E "issuer|certificate"

2Fix

Add the proxy's root certificate to the operating system trust store. On Linux, add it to both the system store and the NSS store. Do not use --ignore-certificate-errors, which the documentation calls dangerous.

# Linux, Debian/Ubuntu: system store (NSS store needs certutil as well)
sudo cp proxy-root.crt /usr/local/share/ca-certificates/
sudo update-ca-certificates

3Verify

Restart VS Code fully, then install an extension.

code --install-extension ms-python.python

Confirmed by code.visualstudio.com

Did this fix it?

Cause 4 of 4

The network cannot be fixed: install from a VSIX file

1Check

On a machine that can reach the Marketplace, right-click the extension in the Extensions view and choose Download VSIX. Copy the file over.

ls *.vsix

2Fix

Install the file with the command line or Extensions: Install from VSIX. Extensions installed this way do not update by themselves.

code --install-extension myextension.vsix

3Verify

The extension appears in the installed list.

code --list-extensions

Confirmed by code.visualstudio.com

Did this fix it?

How do I stop it coming back?

  • Ask your network team to allow the documented Marketplace hostnames before rolling VS Code out to a new office or server.
  • Keep proxy settings in one place, either the system or http.proxy, and document it for the team.
  • Keep the VSIX files of must-have extensions in a shared folder for offline machines.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Related fixes

Web apps

OpenAPI does not work in an ASP.NET Core minimal API

404 Not Found at /openapi/v1.json

ASP.NET Core 9 and later generate OpenAPI documents with the Microsoft.AspNetCore.OpenApi package: AddOpenApi registers it and MapOpenApi serves /openapi/v1.json.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.