[Fix] “Error while fetching extensions XHR failed”

The Error “Error while fetching extensions. XHR failed”, is an error that is invoked whenever you are coding in visual studio code. Given below is the snippet of the error you might get:

"Error while fetching extensions. XHR failed"

I would like to share with you the steps I took to fix the “Error while fetching extensions. XHR failed” in your project file.

Why “Error while fetching extensions XHR failed” Error is Seen?

The error, “Error while fetching extensions. XHR failed” is seen because the proxy settings you are using in your PC is conflicting with the VS Code settings you are using.

The detailed solution to fix the error “Error while fetching extensions. XHR failed”, is given below:

How to fix Error while fetching extensions XHR failed?

To fix the Error while fetching extensions XHR failed, you have to update your json settings to update your proxy settings as “delete all brackets containing proxy data” into tab “Http: Proxy Authorization” settings.

You can also change your proxy directly through your operating system’s settings section. Once settings are changed, now restart your Visual Studio Code and Error while fetching extensions XHR failed would be resolved.

To fix the error, “Error while fetching extensions. XHR failed”, you have to follow the steps mentioned below:

Method 1: Update your JSON Settings

To to fix the error you will have to update your json settings. You will have to update your json in your visual studio code. Follow the below mentioned steps to do so:

Step 1: Press F1 in your visual studio code.

Step 2: Type in the following “User Settings”.

Step 3: Search for the Proxy section.

Step 4: In proxy section, look for the title `Http: Proxy Authorization`

Step 5: Press on the option ‘Edit in settings.json’

Step 6: You will have to delete all brackets containing proxy data

Step 7: Save your JSON file

Once you have followed the above steps, just restart your visual studio code. You can also locate your JSON in the following path %appdata%/Code/User/settings.json

This should fix the error, “Error while fetching extensions. XHR failed”.

Method 2: Directly Update your Proxy Settings

To fix the directly from your computer’s settings you will have to follow the steps mentioned below:

Step 1: Open your PC setting and find system proxy settings.

Step 2: Open cmd or terminal, type the following code echo %http_proxy%, if any output, make sure it fits your pc proxy setting. Because if the proxy on visual studio code is not being set, will be inherited from the http_proxy and https_proxy environment variables.

Step 3: If there is no output from running the above mentioned code, open visual studio code settings.json and add “http.proxy”:”http://proxyname:port” that fits your pc proxy setting, without a trailing slash.

This should fix the error, “Error while fetching extensions. XHR failed”.

Conclusion

To fix the error “Error while fetching extensions. XHR failed”, you have to update your json settings to update your proxy. You can also change your proxy directly through your operating system’s settings section.

Basically, to fix the Error while fetching extensions XHR failed, you have to update your json settings to update your proxy settings as “delete all brackets containing proxy data” into tab “Http: Proxy Authorization” settings.

You can also change your proxy directly through your operating system’s settings section. Once settings are changed, now restart your Visual Studio Code and Error while fetching extensions XHR failed would be resolved.