Skip to content
Latchkey

Azure Pipelines NuGet "Unable to load the service index for source"

NuGet asked the feed for its service index and was rejected, usually with a 401. The feed is reachable, but restore ran without an authenticated NuGet config, so the private Azure Artifacts source refused it.

What this error means

A dotnet restore or NuGet restore step fails with Unable to load the service index for source https://pkgs.dev.azure.com/... and Response status code does not indicate success: 401 (Unauthorized).

Azure DevOps
error NU1301: Unable to load the service index for source
https://pkgs.dev.azure.com/org/_packaging/feed/nuget/v3/index.json.
Response status code does not indicate success: 401 (Unauthorized).

Common causes

Restore ran without feed credentials

The job restored against a private feed without an authenticated NuGet config, so the service index request returned 401.

The build service lacks feed access

Even with a token, the pipeline identity may not be a reader on the feed, so it is unauthorized.

How to fix it

Use the DotNetCoreCLI restore with the feed

Restore through the task that authenticates the internal feed, or run NuGetAuthenticate first.

azure-pipelines.yml
- task: NuGetAuthenticate@1
- task: DotNetCoreCLI@2
  inputs:
    command: 'restore'
    projects: '**/*.csproj'
    feedsToUse: 'select'
    vstsFeed: 'Platform/feed'

Grant the build service read on the feed

  1. Open the Azure Artifacts feed settings, Permissions.
  2. Add the project build service identity as a Reader (or Collaborator).
  3. Re-run restore so the index loads with access.

How to prevent it

  • Run NuGetAuthenticate (or the authenticated restore task) before restore.
  • Grant the build service Reader on every private feed it restores from.
  • Keep nuget.config pointed at the right feed index URL.

Frequently asked questions

What causes ""Unable to load the service index for source""?
The job restored against a private feed without an authenticated NuGet config, so the service index request returned 401.
How do I fix "Unable to load the service index for source"?
Restore through the task that authenticates the internal feed, or run NuGetAuthenticate first.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card