nugetazure-devopsnuget-package-restorebuild-agentdotnet-restore

dotnet restore failing - Unable to load the service index for source [package name]


I have a build in VSTS which is failing with the following error:

error :   Unable to load the service index for source [source name] 2018-02-28T09:04:12.1080070Z /usr/share/dotnet/sdk/1.1.4/NuGet.targets(102,5)
error :   Response status code does not indicate success: 402 (Payment Required - The user does not have a license for the extension ms.feed. 

This happened after reducing the access level of the user who created the Package from Basic to Stakeholder in VSTS, which in turn removed the Package Management extension from that user also. Putting the access level back to Basic and giving them the Package Management extension resolves the issue, although this is not a long term fix as they've left the company now.

I've ensured that there are users that with the Package Management extension, and also with a PAT that has permissions for Packages. I then updated the password in the nuget.config file to be the aforementioned PAT token, however the build still fails with the above error if the user who set the Package is at Stakeholder level.

I'm guessing that the user set up something with their PAT which in some way links them to the package, but I'm struggling to find what this is/where it might be.

I'm running the build on a build agent hosted in Docker.

Any help would be much appreciated - thanks!


Solution

  • The 402 Payment Required status code means that the private feed/package is locked because the feed owner's subscription has expired.

    If the owner of a private feed downgrades a paid subscription to a free one or if the subscription expires, any private feeds on the account will become read-only for a period of days. After this period, the feed will become locked, meaning private feeds cannot be accessed until the subscription is renewed or the feed is made public.

    As a workaround, you could abandon the package and use a new user with the Package Management extension license to create a new package on same setting.