Why is VSCode "Unable to open Extension. An unknown error occurred."? - visual-studio-code

This is my first time installing and using VSCode, and when I tried installing Prettier extension, it let me peek quickly at the extension page before closing it and displaying this notification (Screenshot attached):
Unable to open 'Extension: Prettier - Code formatter': An unknown error occurred. Please consult the log for more details..
VSCode screenshot: Notification at bottom right
It's doing this with all other extensions. Searched for a solution but found nothing applicable.
Why is this happening and how to fix it?

It happens that, this is a problem with the Egyptian ISPs' default DNS servers, which are most probably blocking some of Microsoft servers.
The solution (in case you live in Egypt):
clear DNS cache using ipconfig /flushdns command on Windows cmd (For Other OS).
change the default DNS servers in your router settings to Google's 8.8.8.8 & 8.8.4.4 (or Cloudflare's 1.1.1.1 or any other DNS server you trust).
restart VSCode and try installing extensions.
Hopefully, everything will work fine by now.
Check this Github issue for more insight.

It probably is because of the certificate check.
Below solution works for me in CentOS 7 (Linux).
Step 1. Change the file /usr/share/applications/code.desktop
Open the file /usr/share/applications/code.desktop,
then modify the Exec value with adding --ignore-certificate-errors before %F:
Exec=/usr/share/code/code --unity-launch --ignore-certificate-errors %F
Save the file with typing sudo in the begining.
Step 2. Close all windows of vs code instances.
Step 3. Back to the terminal, use below command to open VS code:
code --ignore-certificate-errors
Step 4. Click extension button in the left side bar.
Click any extension like "Ruby" by Peng Lv, if the images in the Details page can be seen successfully, perhaps the issue is solved.
Step 5. Try to continue to install the extensions you need.
Just enjoy! May it be helpful for you.

in ubuntu go to settings -> wifi -> click on gear icon -> IP4 -> dns input
and put
8.8.8.8,8.8.4.4
and click apply,
to DNS Resolver Cache open terminal and type:-
sudo systemd-resolve --flush-caches
sudo systemctl restart systemd-resolved
restart your device

For windows
cd "C:\Users\<user>\Appdata\Local\Programs\Microsoft VS Code"
code.exe --ignore-certificate-errors

The solution
clear DNS cache using command on Windows cmd:
ipconfig /flushdns
change the default DNS servers in your router settings to Google's:
8.8.8.8 , 8.8.4.4 >> for IPv4
2001:4860:4860::8888 , 2001:4860:4860::8844 >> for IPv6
This link will guide you how to change the DNS server in windows and mac:
https://www.ionos.com/digitalguide/server/configuration/how-to-change-dns-server/
restart VSCode and try installing extensions.

If you're in a corporate network and it's locked down the one last resort is to manually download the VSIX from the website on a domain that will allow it and then copy over the VSIX and install it.

I got this "XHR failed" error in Visual Studio Code.
So I changed my network settings to use Google Public DNS (instructions)
Finally following instructions (by mohamed-mokhtar) solved for me:
Go to : Control Panel\Network and Internet\Network Connections
Choose your connection network and ( right click on it then choose properties )
Select " Internet Protocol Version 4 (TCP/IPv4) and then click on properties in the bottom of this section
At General section click on " Use the following DNS Server address : "
Make " Preferred DNS server : 8.8.8.8 " (if you face a problem check this)
Make " Alternate DNS server : 8.8.4.4 "
Restart VS code

referring to #Seif A. answer
The solution (in case you live in Egypt)
clear DNS cache using command on Windows cmd:
ipconfig /flushdns
change the default DNS servers in your router settings to Google's:
8.8.8.8 , 8.8.4.4 >> for IPv4
2001:4860:4860::8888 , 2001:4860:4860::8844 >> for IPv6
restart VSCode and try installing extensions.

I faced the same problem while adding new extension in vs code.
I Recognized the problem within the ISP in Egypt, so I changed the DNS in My router to Google DNS Providers , and it works perfectly

Just install a VPN like betternet or any other VPN software and change the country to the USA or try other countries.

In my case I was need to disable work VPN to download extension

Related

Cannot connect to MongoDB Atlas Cluster: DNSHostNotFound

I created a new cluster in MongoDB Atlas but I can't connect to it thru the mongo shell.
C:\git_symphony\esp8266\SymphonySocket>mongo "mongodb+srv://<clustername>-gy7bf.azure.mongodb.net/test" --username <USERNAME>
DNSHostNotFound: Failed to look up service "":No records found for given DNS query.
try 'mongo --help' for more information
I tried switching regions but it didn't work. I've also tried using Compass on my mac but it just loads indefinitely when I try to connect. What could possibly be wrong?
Turns out, my ISP blocks all connections to MongoDB for some reason. I haven't contacted them yet, but I find this very silly as I racked my brains out trying to solve this when the problem wasn't at all in my control.
I also had this problem with Comcast Xfinity. DHCP sets DNS servers that would not lookup the mongodb connections. I'm running KDE Neon Linux (Ubuntu 18.04). In order to get things working I had to supersede the domain-name-servers supplied through comcast. I used Google's public DNS, but there are others that can be used. I had to edit (you'll need root permissions) the /etc/dhcp/dhclient.conf file, and added to following line:
supersede domain-name-servers 8.8.8.8, 8.8.4.4;
I hope this helps somebody, took me too long to figure it out. :-)
I just found this post by M. Brandao with the fix for Windows users:
Open the Control Panel.
Click View network status and tasks
Click Change adapter settings on the left portion of the window.
Double-click the icon for the Internet connection you're using.
Click the Properties button.
Click and highlight Internet Protocol Version 4 (TCP/IPv4) and click
Properties.
If not already selected, select the Use the following DNS server
addresses option.
Enter the new DNS addresses (see above) and click OK and close out of all otherwindows.
Have you whitelisted your IP address ? IP whitelisting is important otherwise it will not connect.
Have you created this cluster recently and is it in the europe region ?
Is the cluster properly deployed or you are experiencing any issue in the deployment of the cluster ?

Error message showing DNS_PROBE_FINISHED_NXDOMAIN

I site I own has the following error message on all browsers DNS_PROBE_FINISHED_NXDOMAIN. I have flushed the cache and updated the DNS with Googles public but neither have worked and not sure what the problem could be. Can anyone help?
If your DNS_PROBE_FINISHED_NXDOMAIN issue in a windows computer, You can solve this issue using DNS Client Service restarting.
Open Command Prompt (Windows key + R key), type services.msc -->
Enter.
Now open services window, Find "DNS Client" service.
Right click, select Restart.
Otherwise if you not try Release and Renew IP Address, It should be worked. So, Follow 8 options to how to fix DNS_PROBE_FINISHED_NXDOMAIN

VSCode Failed to update extensions

I'm facing issue with VSCode for a while, I'm unable to detect the issue which prevent me to update Extensions
Failed to update 'ms-python.python'.
Failed to update 'formulahendry.code-runner'.
it's all about DNS issue:
Click that Link and if you able to see the logo so i will consider another solution.
But if not so change your DNS to be:
8.8.8.8
8.8.4.4
OR
1.1.1.1
1.0.0.1

Proxy setting in gsutil tool

I use gsutil tool for download archives from Google Storage.
I use next CMD command:
python c:\gsutil\gsutil cp gs://pubsite_prod_rev_XXXXXXXXXXXXX/YYYYY/*.zip C:\Tmp\gs
Everything works fine, but if I try to run that command from corporate proxy, I receive error:
Caught socket error, retrying: [Errno 10051] A socket operation was attempted to an unreachable network
I tried several times to set the proxy settings in .boto file, but all to no avail.
Someone faced with such a problem?
Thanks!
Please see the section "I'm connecting through a proxy server, what do I need to do?" at https://developers.google.com/storage/docs/faq#troubleshooting
Basically, you need to configure the proxy settings in your .boto file, and you need to ensure that your proxy allows traffic to accounts.google.com as well as to *.storage.googleapis.com.
A change was just merged into github yesterday that fixes some of the proxy support. Please try it out, or specifically, overwrite this file with your current copy:
https://github.com/GoogleCloudPlatform/gsutil/blob/master/gslib/util.py
I believe I am having the same problem with the proxy settings being ignored under Linux (Ubuntu 12.04.4 LTS) and gsutils 4.2 (downloaded today).
I've been watching tcpdump on the host to confirm that gsutils is attempting to directly route to Google IPs instead of to my proxy server.
It seems that on the first execution of a simple command like "gsutil -d ls" it will use my proxy settings specified .boto for the first POST and then switch back to attempting to route directly to Google instead of my proxy server.
Then if I CTRL-C and re-run the exact same command, the proxy setting is no longer used at all. This difference in behaviour baffles me. If I wait long enough, I think it will work for the initial request again so this suggests some form on caching taking place. I'm not 100% of this behaviour yet because I haven't been able to predict when it occurs.
I also noticed that it always first tries to connect to 169.254.169.254 on port 80 regardless of proxy settings. A grep shows that it's hardcoded into oauth2_client.py, test_utils.py, layer1.py, and utils.py (under different subdirectories of the gsutils root).
I've tried setting the http_proxy environment variable but it appears that there is code that unsets this.

Debug Google AppEngine localhost from different Machine

I'm using eclipse to debug a google app engine app. I'd like to connect to the GAE App running on Eclipse on my laptop from my iPhone.
In eclipse I tried Run->Debug Configurations and then adding an --address option to use my IP address
But I must not be doing it right because I get this error when I try to debug
[Java CocoaComponent compatibility mode]: Setting timeout for SWT to 0.100000
Usage: [options]
Any idea how to do this?
Thanks!
I had the same issue, found this post and was able to solve with your tips. Thanks
First, don't add the --address at the end of the argument list or the war path gets auto added twice to the arguments (see in your screen shot that you have an extra /Users/arc/Documents/workspace/jsoup/war added after the --address
Second. The --address doesn't seem to work for me on Linux Mint and Eclipse Junu. I had to use -a
So my argument list looks like:
-a 0.0.0.0 --port=8080 /home/d/workspace/blah/war
Setting the IP address to 0.0.0.0 should get it working.. (I don't know how to successfully do that in Eclipse)
Add -bindAddress *localIPaddress* just before -port argument. It worked for me.
For those looking into this who are using IntelliJ you need to go to Edit Configurations. Under your AppEngine Dev Server you'll find a page where you can set "Server parameters". Set this to:
--address=[ip address]
for example
--address=192.168.1.115