Home: Package Manager Error: Unable to load the service index for source (bad proxy settings)

Created on 1 Jun 2016  Â·  59Comments  Â·  Source: NuGet/Home

nuget

Following error received when searching for packages in the package manager

[nuget.org] Unable to load the service index for source https://api.nuget.org/v3/index.json.
Invalid URI: Invalid port specified.

External

Most helpful comment

For me removing the .nuget folder located in C:\Users\YourNameHere fixed the problem.

All 59 comments

What version of NuGet are you using in VS?
can you please send a fiddler trace to [email protected]

This is likely a bad proxy, or an older version of NuGet?

NuGet package Manager v 3.4.4.1321

How can I find the fiddler trace? I'm fairly new to visual studio and such.

Today I'm experimenting the same problem (in the past few days everything worked fine). If I run Fiddler I don't see any HTTP call but I got the error. What can I do?

Thanks

I finally ran Fiddler and saw the same. No HTTP but have the error

Finally I found the issue, at least in my case: if no Windows HTTP proxy is specified, NuGet uses (if present) the HTTP Proxy specified in the environment variable http_proxy.

Were you able to fix the issue?

Yes, removing the env var http_proxy fixed the issue (in my case).

Sorry i'm not too familiar with how to do that. How can i remove that env var?

Open "System Properties" > Advanced > Environment Variables. Find the http_proxy var (in System variables), select and delete it.

Incredible. It worked! Thanks big time. I've been stuck at this point for well over a month

In mac os x shell I typed
export ALL_PROXY=proxy ip address :port number
then typed
dotnet restore
It's work fine

For me, a simple VS restart fixed the issue.

In my computer I should go to catalog:
C:\Users\myUserName\AppData\Roaming\NuGet

And edit NuGet.xml file:

Working file looks like this:

Uploading NuGet.txt…

  1. Copy Nuget.exe by any peer projects via copying .nuget folder to "NONWorking" project folder..
  2. In windows, IE has proxy settings, some times its gets checked for no great reason... uncheck, if you dont use proxy.
  3. restore the solution in VS 2015.. I got it resolved on my machine.

For me removing the .nuget folder located in C:\Users\YourNameHere fixed the problem.

@VSG24 Thanks a ton! Removing .nuget from my profile (C:\Users\.nuget) worked like a charm!

Environment:
Windows 10 Pro RTM x64
dotnet SDK version 1.0.0-rc4-004771
Shell: Native Windows Command Shell

My issue was simple... my virtual machine lost internet connectivity!

Can somebody help me with this issue? I am not using any kind of proxy and I have a brand new install of VS 2017 ..

```
[nuget.org] Unable to load the service index for source https://api.nuget.org/v3/index.json.
An error occurred while sending the request.
The remote name could not be resolved: 'api.nuget.org'
Unable to load the service index for source https://api.nuget.org/v3/index.json.
An error occurred while sending the request.
The remote name could not be resolved: 'api.nuget.org'
Time Elapsed: 00:00:38.4173999
========== Finished ==========

` ![using package manager console](https://cloud.githubusercontent.com/assets/16449737/26712265/b29657ce-4783-11e7-9768-64c8d9849dfc.png)

Hi all, if you use Ubuntu server, this error fixed by install : https://www.howtoinstall.co/en/ubuntu/xenial/libcurl3

Would be nice if the error message could say "cannot reach 93.184.221.200" or similar (basically tell me which host or IP that couldn't be reached).

Today our IDS had blocked nuget, because it believed the nuget host had performed a port scan on us. I doubt that is likely (far more likely that our frequent builds trigger lots of traffic to the nuget servers and this confused a poorly configured IDS).

In any case..: A nicer error message would have sorted out our problem faster.

Restarting VS works for me too.

Had no environment variables mentioned here, was using new .Net IDE called Rider, on ubuntu, libcurl3 was already present.

Ended up setting the IDE to use a proxy and then saved and then set to no proxy and saved.
Solved.

Thought it was a versioning issue as I'm using an old vs2015 project, but even changing the version used by project didn't help. Although it resolved a separate issue for me as mono supported .net >=4.5 and I had it targetting 4.5 but forgot I needed a nuget package thats linked to 4.6 :)

Had the same issue today, removed .nuget folder from my profile folder and it started working again. The other things before (env var etc.) didn't work.

Hi, i've the same problem.. I tryed to remove .nuget folder but it is still not working. In my environment variables i did not find any http_proxy var. I've this problem for days, please help me to solve it! :(

I have the same problem. Can I manually download and install the package in my project?
Actually, I have installed the same package( Which I want in a new project but this problem sucks) in another project, So is there any way to use it in another project directly?

Go for Settings ( Global Settings of your PC ) > Network and Internet > Proxy > Automatic Proxy Setup > and set Automatically detect settings to off. This Works for me.... Try this ...

I solved the problem! Thank you @VishalTank3010

@nkuhan Hi, could you elaborate the command? What is the value of ip address and port number? I encountered this problem on my Mac too.

I have the same issue:
unable to load the service index for source https://api.nuget.org/v3/index.json fot timeout
Please help me out

Closing as this looks like a local environment problem and not an actionable client issue.

It gave bash: export::port': not a valid identifierwhen I triedexport ALL_PROXY=proxy ip address :port numbera Mac, what is theport` tobe used?

Firstly i was removing the .nuget folder located in C:\Users\YourNameHere fixed the problem. but wen i have creat another new project in VS i have the same problem

So i have do remove this environnemental variable path value : C:\Program Files\dotnet
and update VS 17.
i'm on Windows 10 Pro.

i am having this problem in docker-compose
error : Unable to load the service index for source

How can i fix this without disable the enviroment variable http_proxy?

For now it is working for me.
just adjust the Nuget.Config in Users...\Appdata\Roaming\Nuget

<configuration>
  <config>
    <add key="HTTP_PROXY" value="http://proxy_server_name:8080/" />
  </config>
  <packageSources>
    <add key="nuget.org" value="http://api.nuget.org/v3/index.json" protocolVersion="3" />

Managed to fix the issue using "dotnet restore" command in "Package Manager Console"

I did not have http_proxy variable set on my machine, fix was to run the visual studio in admin mode. with this i was removed the above error.

In my case, there was no env variable http_proxy

I've fixed this issue by creating nuget.exe.config in the same folder as nuget.exe

C:\Program Files (x86)\NuGet\nuget.exe.config

<configuration>  
  <system.net>  
    <defaultProxy 
      enabled="false"  
          useDefaultCredentials="true">
    </defaultProxy>  
  </system.net>  
</configuration>

Fixed by adding protocolVersion="3" in C:\Users\UserName\AppData\Roaming\NuGet\NuGet.config.

<packageSources>
   <add key="nuget.org_v3" 
             value="https://api.nuget.org/v3/index.json" 
             protocolVersion="3" />
</packageSources>

In our case it was the account actually running nuget.exe that did not have appropriate permissions. We ended up using the "runAs" team city plugin to solve this, running specific features with different user accounts.

My virtual machine in VirtualBox has broken networking after waking up PC from a sleep. I always have to change the network adapter's "attached to" value, confirm the change and revert it back. Example: change "attached to" from NAT to "bridged adapter", confirm, and revert it back.

For me this problem occurred after I installed Fiddler and a session with Fiddler crashed unexpectedly. It seems Fiddler had failed to restore some functionality related to the network settings of my laptop (or whatever). Once I ran Fiddler again and successfully ended the session (actually just opening Fiddler) all of a sudded NuGet runs fine! I discovered this by opening https://api.nuget.org/v3/index.json in Chrome and seeing that it worked fine there, so the problem was within Visual Studio itself, or some application that had affected its settings. So that's how I suspected Fiddler. Anyway, maybe this helps someone.

Many thanks to all of you.
The 'root' problem above also causing another problems such as:
Xamarin error MSB4019....
etc.. etc.. depending on what project you are building

I was finally resolve the problem by doing the following step:

  • DELETE .nuget folder inside%userprofile%
  • Edit nuget .config located in %appdata%\NuGet\NuGet.Config by adding protocolVersion="3"
    to <add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
    so it becomes:
    <add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3"/>

in 2018 we are still struggling to resolve a proxy issue. Microsoft Visual Studio does not either provide an option to define a proxy location. You have to manually go to devenv config to set this up.
Nuget issue is still not resolved after spending 2 hours. !!!

Same problem for me. really annoying. Every day now I think about switching to Java and leaving MS behind.

Do these steps

  1. Delete .nuget from c/users/[username]
  2. Restart your VS and make sure you are connected to the internet.
  3. Build the solution

Do these steps

  1. Delete .nuget from c/users/[username]
  2. Restart your VS and make sure you are connected to the internet.
  3. Build the solution

Is that worked for you?

For me it was firewall issue and now it is working like a charm.

If in Linux, I was able to get restore working on my Solus box by first running
export DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0. Once I did that, dotnet restore worked.

export DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0 
dotnet restore

I had recently installed/uninstalled Fiddler and was getting this error and ended up having to add defaultProxy settings back to C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe.config
https://stackoverflow.com/questions/46500032/unable-to-load-the-service-index-for-source-https-api-nuget-org-v3-index-json?rq=1

@microsmith, thank you for the hint! In my case it was the firewall!

I tried to remove the .nuget folder located in C:\Users\YourNameHere and the error continues, what can I do in that case?, I'm working in vs 2019

For me, open Fiddler 4 temporary fixed the problem but closing it causing error again.

This trick solved the problem https://stackoverflow.com/a/58851687/3763113

This worked for me

  1. Close the visual studio
  2. delete .vs folder from the root of your project
  3. Re open the visual studio and compile.

I had recently installed/uninstalled Fiddler and was getting this error and ended up having to add defaultProxy settings back to C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe.config
https://stackoverflow.com/questions/46500032/unable-to-load-the-service-index-for-source-https-api-nuget-org-v3-index-json?rq=1

Great! That worked for me! Thank you

@VSG24 Thanks a ton! Removing .nuget from my profile (C:\Users\.nuget) worked like a charm!

Just wanted to point out an additional tip. I have struggled as much as you guys, but the problem was that the docker image does not know my proxy server. It cannot resolve any dns entry, so I have added the HTTP_PROXY / HTTPS_PROXY to my dockerfile as arguments with the ip-address instead of the dns name.

ARG HTTP_PROXY=http://\:\/
ARG HTTPS_PROXY=http://\:\/
FROM [...]

This worked for me

  1. Close the visual studio
  2. delete .vs folder from the root of your project
  3. Re open the visual studio and compile.

Worked for me

Was this page helpful?
0 / 5 - 0 ratings