Pages

Topics

Tools

↑↓navigate↵openescclose
All guides

NuGet NU1101: unable to find the package in any source

The package is not on any feed this solution queries. Check the inherited source list first, then authentication.

~5 min readC#
#.NET#NuGet#CI#Package Management
Three feed pipes converging on a package crate with one pipe sealed and a cyan magnifier

Introduction & Quick Summary

dotnet restore fails with:

code
error NU1101: Unable to find package Serilog.Sinks.File. No packages exist with this id in source(s): nuget.org

The build stops before compilation. NuGet asked every configured source for that package id and none had it. The error is about sources, not about the package itself, which is why the same solution restores on one machine and fails on another.

The four causes, in the order they are actually seen:

  1. A typo or a renamed package. NuGet ids are exact (Serilog.Sinks.File, not Serilog.Sink.File); a package that was renamed or deprecated is not found under the old id by default.
  2. A nuget.config that cleared the default sources. A repo-level file with <clear /> plus one private feed removes nuget.org entirely, and every public package becomes unfindable.
  3. The package lives only on a private feed you are not authenticated against. The feed answers 401, and with some configurations the failure surfaces as "no packages exist".
  4. A prerelease-only or unlisted version. --prerelease or an explicit version range is required, and the id alone finds nothing.

The first diagnostic is always dotnet nuget list source: it shows what this solution will actually query, including the inheritance chain that most people get wrong.

Core Mechanics, Signatures & Reproducible Setup

NuGet builds a source list from a hierarchy: the machine-level config, the user-level config, then every nuget.config from the drive root down to the current directory, with the closest file winning for most settings and <clear /> able to remove inherited entries. dotnet restore then queries each enabled source's service index and matches package ids case-insensitively against what the source exposes.

bash
dotnet nuget list source # effective list for this directory dotnet nuget locals all --list # global package folder and http cache dotnet restore --verbosity detailed # every source query and its result

A minimal reproduction: a project that references a package only a private feed has, restored on a machine with the default config.

xml
<!-- repro.csproj --> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net10.0</TargetFramework> </PropertyGroup> <ItemGroup> <PackageReference Include="Acme.Internal.Logging" Version="3.2.1" /> </ItemGroup> </Project>
bash
dotnet restore # error NU1101: Unable to find package Acme.Internal.Logging. # No packages exist with this id in source(s): nuget.org

Add the source properly and the same restore succeeds:

bash
dotnet nuget add source https://nuget.pkg.github.com/acme/index.json \ --name acme --username "$GH_ACTOR" --password "$GH_TOKEN" --store-password-in-clear-text dotnet restore

Key Comparison Table

Error codeMeaningTypical causeFix
NU1101id not found in any sourcetypo, missing source, <clear />add or fix the source
NU1102id found, no version in rangeversion pin too tightwiden the range or the version
NU1103no version satisfies the minimumprerelease excludedinclude -* or --prerelease
NU1301unable to load the service indexfeed down, 401, proxycheck auth and connectivity
NU1109downgrade detectedcentral package management conflictalign versions in one place
NU1603resolved with a different versionapproximate matchadd the exact reference
Config locationScopeWins over
Machine-level NuGet.Configall usersnothing below it
%AppData%/NuGet/NuGet.Configthe usermachine-level
Solution directorythat solutionuser-level
Project directorythat projectsolution directory
Environment RestoreSourcesthe restore processmost files

Practical Edge Cases, Error Fixes & Deep Dive Code Examples

1. <clear /> plus one feed is a trap

This is the most common CI failure in enterprise repositories: the config was written for a build server with a mirror, and it silently removes everything public.

xml
<!-- nuget.config --> <configuration> <packageSources> <clear /> <add key="acme" value="https://pkgs.dev.azure.com/acme/_packaging/main/nuget/v3/index.json" /> </packageSources> </configuration>

Add nuget.org explicitly when the project needs public packages, and keep the private feed for internal ones:

xml
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />

2. Package source mapping instead of ordering

With more than one feed, NuGet queries all of them for every id, which is slow and, with overlapping private/public mirrors, ambiguous. .NET 6+ supports explicit mapping:

xml
<packageSourceMapping> <packageSource key="nuget.org"> <package pattern="Serilog.*" /> <package pattern="Microsoft.*" /> </packageSource> <packageSource key="acme"> <package pattern="Acme.*" /> </packageSource> </packageSourceMapping>

Once mapping exists, a package whose id matches no pattern is reported as unavailable even if a source has it - which is a clear, fast failure instead of a slow one.

3. Authentication that fails quietly

A private feed that answers 401 can surface as NU1301 during restore of the index, or as NU1101 when the source resolves but returns nothing. Test the feed the way NuGet does:

curl -s -o /dev/null -w "%{http_code}\n" \ -u "$GH_ACTOR:$GH_TOKEN" \ https://nuget.pkg.github.com/acme/index.json

In CI, prefer credentials from environment variables with the documented variable names (NuGetPackageSourceCredentials_<name>, VSS_NUGET_ACCESSTOKEN for Azure Artifacts) over a committed nuget.config with a password in it.

4. Central package management changes where versions live

With Directory.Packages.props, versions come from PackageVersion items, and a <PackageReference> that also sets Version produces NU1109 or an unexpected resolution. NU1101 appears when the package is listed in neither file:

xml
<!-- Directory.Packages.props --> <Project> <PropertyGroup> <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> </PropertyGroup> <ItemGroup> <PackageVersion Include="Serilog.Sinks.File" Version="7.0.0" /> </ItemGroup> </Project>

The project then references the package with no version. A missing PackageVersion line is the equivalent of a missing entry, and the error still says the id does not exist.

5. Prerelease and unlisted versions

An id with only prerelease versions is not found without a prerelease flag, and a version that was unlisted months ago cannot be restored by range unless it is pinned exactly and still in the feed:

bash
dotnet add package Serilog.Sinks.File --prerelease dotnet add package Serilog.Sinks.File --version 7.0.0-rc.1

dotnet package search <id> --source nuget.org lists what the source actually exposes, which separates "wrong id" from "wrong version" in one step.

6. Offline and air-gapped builds

A restore that must not reach the internet needs either a local folder source or a fully populated global packages folder. A local feed is the simpler contract:

bash
dotnet restore --source ./packages # or, permanently dotnet nuget add source "$PWD/packages" --name local

Copy the .nupkg files into ./packages in a step that runs where the network exists, and keep the folder free of extracted contents. For a container build, copy the folder before dotnet restore so the layer is cached.

To see exactly which source answered, and with what, compare a working and a failing restore log in Text Diff: the source name appears in each query line, and the missing one is obvious. When the failing item is an environment variable such as NUGET_PACKAGES or a proxy setting, check the resolved values in Environment Variable Inspector rather than trusting the shell profile.

Common Compilation/Runtime Mistakes & Version Gotchas

  • Deleting the global packages folder as a first step. It re-downloads everything, takes minutes, and changes nothing about a missing source.
  • --no-restore in CI after adding a package. The restore never runs, and the error appears later as a missing reference or a compile error.
  • A committed nuget.config with cleartext credentials. Rotate the token and move it to a secret-backed environment variable.
  • Case and whitespace in package ids. Ids are case-insensitive but not whitespace-insensitive, and a trailing space in an XML attribute is invisible in review.
  • A RestoreSources MSBuild property that overrides the config. It replaces the source list rather than adding to it, so public packages vanish in that pipeline only.
  • Downloading a package manually and dropping the DLL in. The reference works until a transitive dependency is missing; reference the .nupkg through a local source instead.
  • SDK version drift. A newer SDK may change the default TargetFramework resolution and re-evaluate package compatibility; global.json keeps the restore reproducible.

Primary references: NU1101 in the NuGet error reference lists the causes and the source checks, and package source mapping documents how ids are routed to a specific feed.

Official references

primary documentation

The C# documentation that defines the behaviour this guide explains.

Try matching browser tools

All tools

Small utilities that fit C# work — they run entirely in this browser tab, so nothing you paste leaves your device.

All C# guides

More in C#

All C# guides

The guides filed next to this one in C#, in library order.