dotnet restore fails in the pipeline with NU1101 or 401 Unauthorized. How do you fix it?
IntermediateTroubleshooting.NET builds (dotnet CLI)
Answer
Short answer
NU1101 "Unable to find package" means none of the configured feeds has that package (wrong feed, typo, or the private feed isn't configured on the agent). 401 Unauthorized means the feed was found but the pipeline isn't authenticated to it. Fix the nuget.config sources and give the pipeline credentials for the private feed.
Steps
- Look at which feed and package failed in the log.
- Check
nuget.configin the repo lists the private feed:<packageSources> <clear /> <add key="company" value="https://pkgs.dev.azure.com/org/_packaging/shop/nuget/v3/index.json" /> <add key="nuget.org" value="https://api.nuget.org/v3/index.json" /> </packageSources> - Authenticate:
- Azure DevOps:
- task: NuGetAuthenticate@1before restore, and grant the build service access to the feed. - GitHub Actions / others:
dotnet nuget add source ... --username x --password ${{ secrets.FEED_PAT }} --store-password-in-clear-text.
- Azure DevOps:
- For NU1101, confirm the package name and version exist in the feed (internal packages may not be published yet).
- Behind a corporate proxy? Set
HTTPS_PROXYfor the agent.
What to say in the interview
"NU1101 is a missing package across the configured sources; 401 is an authentication issue. I verify nuget.config sources, then authenticate the pipeline with NuGetAuthenticate in Azure DevOps or a PAT secret elsewhere, and make sure the build identity has feed permissions."