VS Code cannot load or install extensions: XHR failed
XHR failedShort 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.
Fix it fast
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.com2Match what you see, then jump to its fix
- 1
The curl test times out or is refused, and other sites loadA firewall or filter blocks the Marketplace hostnamesFix - 2
connect 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
The 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
Marketplace stays unreachable and you need one extension nowThe network cannot be fixed: install from a VSIX fileFix
- 1
What does the error look like?
XHR failedExtensions view stays empty or shows no results for any searchconnect 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.dev3Verify
Reload VS Code and search the Extensions view again.
code --list-extensionsConfirmed by code.visualstudio.com
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 proxy2Fix
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-extensionsConfirmed by code.visualstudio.com
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-certificates3Verify
Restart VS Code fully, then install an extension.
code --install-extension ms-python.pythonConfirmed by code.visualstudio.com
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 *.vsix2Fix
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.vsix3Verify
The extension appears in the installed list.
code --list-extensionsConfirmed by code.visualstudio.com
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 fixWeb apps
npm start runs, but the browser does not refresh when you save a file
Saving a file does nothing while npm start is running
The watcher behind npm start is not seeing your edit.
4 causes, each with a fixWeb apps
django-tailwind cannot find the npm executable (cPanel, Windows, Linux)
CommandError raised by the tailwind management command about npm
django-tailwind runs npm as a subprocess, and Python sometimes cannot find it.
3 causes, each with a fixWeb apps
Node.js fails with uv_cwd ENOENT when its folder is gone
npm, node or next fails at start in a terminal whose folder was removed
uv_cwd is how Node.js asks the operating system for its current working directory.
2 causes, each with a fixWeb apps
Playwright cannot open a headed browser on a Linux server or in Docker
npx playwright test --headed shows no window on a Linux server
A headed browser needs a display, and a Linux server or container has none.
3 causes, each with a fixWeb apps
The shell says pnpm: command not found
npx next dev works, but pnpm dev or pnpm install is not found
The shell cannot find a pnpm executable on PATH.
3 causes, each with a fix