skip to Main Content

So recently I get this error "XHR failed" while trying to download extension and I already try a lot of things changing the setting but still it can’t work. So I decided to try difference Wi-Fi (mySchool) and network (mobile data) and I’m shocked it’s working fine. So, I guess the problem is on my own Wi-Fi. How to deal with it?

I use the latest VS CODE version on Windows 11.

I try a lot of things to fix it and been through GitHub and Stack Overflow too from proxy setting, firewall, DNS, restart router, restart laptop. Also I tried everything in this question too and all but

"XHR failed"

keeps appear and as I said before without changing any setting but only changing Wi-Fi it works fine. So, I hope there’s a solution on my Wi-Fi.

enter image description here

this is the error msgs on therminal:
enter image description here


Updates:

  1. I’m running the same project at home and school.

    I’m using the same laptop at home and school

  2. By "mobile data", I mean hotspot from my cell service (vs. Wi-Fi).

  3. The projects ONLY works for Wi-Fi at school and from my hotspot.

    It does NOT work from my home Wi-Fi.

  4. It fails not only for remote explorer, but the other ones too.

    I can’t try to reload the extension that I want to download. The error always occurs, not only on Remote Explorer.

  5. The other problem is "can't connect to discord via RPC: Error: could not connect"

2

Answers


  1. Chosen as BEST ANSWER

    I found the solution for my problems. it solved by using vpn. the problem was my wifi provider probably blocking the request on vs code, seems like there's something fishy about the DNS policy. Hope this can help too


    1. Your problem is the same as discussed in this thread:

    2. Unfortunately, there are several DIFFERENT possible root causes, and several different workarounds and solutions discussed in the thread.

    3. You said you "tried several things". Please Update your post and specify exactly WHAT you tried, and the results.

    4. You said it "works" on certain networks, but fails on your (home? school? other?) network (whether or not the network is "wifi" or not probably doesn’t matter). Please clarify exactly "what’s different" between the networks (to the best of your knowledge).

    5. Please specify the platform you’re running VSCode on (windows? MacOS? Linux? Other?)

    6. Try this (one of the responses in the SO thread I cited above):

    https://stackoverflow.com/a/71456820/421195

    1. press f1
    2. search "user setting"
    3. click enter
    4. search on user setting "proxy"
    5. click enter
    6. look for "use the proxy support for extensions."
    7. change "override" to on

    Q1: You’re running the same version of VS Code, on Windows, using the same project, at home and at school, correct?

    <= Q: Are you using the same PC (e.g. carrying a laptop from home to school), or are you using different PCs at home and at school?

    Q2. By "Mobile data" (vs. "wifi"); you mean you "hotspot" for your cell phone service, correct?

    Q3. The project ALWAYS works for Wifi (either at home or school), but NEVER works for your Hotspot, correct?

    Q4. You’re always trying to run the Remote Explorer extension in VS code when the error occurs (it never happens with other VSCode activities), correct?

    <= Q: Any problems in other areas of VSCode (e.g. your compiler)?

    Q5. The exact error message is The editor could not be opened due to an unexpected error: XHR failed, correct?

    <= Q: Always using Remote Explorer, correct? What exactly are you doing in Remote Explorer?

    BE SURE TO TRY ALL THE TROUBLESHOOTING TIPS HERE

    (including verifying "ssh" from the VSCode command line, using your "bad" network):

    https://code.visualstudio.com/docs/remote/ssh

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search