cacheport

Error · NuGet

Fixing NuGet error NU1301: Unable to load the service index

dotnet restore could not download the service index of a package source, the first file NuGet needs from any V3 feed. Restore cannot continue without it.

What you see

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

Common causes

  • Network timeouts or DNS failures reaching the feed.
  • Proxy settings missing in the build environment.
  • Expired or missing credentials for a private feed.

How to fix it

  1. 01

    See which source fails

    Detailed verbosity prints every request.

    shell
    dotnet restore -v detailed
  2. 02

    Retry restores

    Newer SDKs retry transient failures; on older ones, wrap restore in a retry loop.

    shell
    for i in 1 2 3; do dotnet restore && break; sleep 10; done
  3. 03

    Use one feed that is close

    Replace nuget.org with a regional cache in nuget.config.

    nuget.config
    <packageSources>
      <clear />
      <add key="cacheport" value="https://acme.cacheport.cc/nuget/v3/index.json" />
    </packageSources>

Other network failures in builds

Start on the free plan

20 GB of cache, every registry, unlimited users. Upgrade when your pipelines outgrow it.