Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuget Restore Error NU1301 Load Service Failure

When I run dotnet restore --interactive it keeps sending this error:

error NU1301: Unable to load the service index for source https://www.nuget.org/api/v3/index.json

But when I checked out my source configration in Nuget management, it is https://api.nuget.org/api/v3/index.json and it can be opened through browser.

How can I change that url to the correct one?

I can see in .nuget/nuget/nuget.Config the packageSource settings has the line with:

key="nuget.org" value="https://api.nuget.org/v3/index.json" protocalVersion="3"

But when I go restore nuget packages, it is still hitting https://www.nuget.org/api/v3/index.json. Why? Are there any other files I missed to change?

like image 636
Rich Avatar asked Dec 17 '25 22:12

Rich


2 Answers

According to the documentation's article NuGet Error NU1301:

  • Restore could not be completed because the listed source is unavailable.
  • Consult the error message for more details.
  • You may need to inform the source owner as there might be issues that only they can address.
  • Alternatively, you can try removing the source from the configuration retry again. The configured source may not be necessary for your build.

And the last sentence worked for me. No detailed error message was available, even with dotnet restore --verbosity detailed. The first source owner is not interested in support, and the current (my company) knows nothing more. So I disabled this source for this particular project with dotnet nuget disable source <source_name>, and yes, the source was not necessary.

like image 192
Gerard Jaryczewski Avatar answered Dec 21 '25 08:12

Gerard Jaryczewski


My team was facing the same issue restoring within docker compose even for https://api.nuget.org/v3/index.json. As hinted at in comments from @Levi Fuller and @PicoutputCls, this was a DNS issue. In our case, though, it wasn't a private nuget source nor was our IT team blocking container requests (to my knowledge?). Ultimately, to resolve the issue, we had to set the DNS in our Docker Engine configuration:

{
  ...,
  "experimental": false,
  "dns": [
    "10.1.2.3",
    "8.8.8.8"
  ]
}

What DNS entries you use is up to you; we used our network's private DNS with a fallback on Google, but YMMV.

Interestingly, curl https://api.nuget.org/v3/index.json worked just fine...

like image 25
Matt K Avatar answered Dec 21 '25 08:12

Matt K



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!