Skip to content

/codes/nuget/nuget-error-codes

NuGet error and warning codes: NU1101, NU1102, NU1301, NU1605, NU1608, NU1701, NU1903

verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash)updated
tool
NuGet
versions
.NET 6 – 10 SDK, NuGet 6.x – 7.x
os
any

NuGet prefixes every restore problem with an NU code. Codes from NU1100 to NU1199 are resolution failures (the package or version cannot be found or does not fit), NU13xx are feed and network problems, NU16xx are warnings about the resolved graph (downgrades, approximate matches, versions outside a dependency's range), NU17xx are compatibility warnings, and NU190x report known vulnerabilities. With TreatWarningsAsErrors, any warning code also fails the build.

Three codes from one restore

bash
cat > nuget.config <<'EOF'
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <clear />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
  </packageSources>
</configuration>
EOF
cat > App.csproj <<'EOF'
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net10.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Newtonsoft.Jsonn" Version="13.0.3" />
    <PackageReference Include="Newtonsoft.Json" Version="99.0.0" />
  </ItemGroup>
</Project>
EOF
echo "--- nuget.org"
dotnet restore 2>&1 | grep -oE "error NU110[12]: Unable to find package [^[]*" | sed 's/ *$//' | sort -u
echo "--- a feed that does not answer"
cat > nuget.config <<'EOF'
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <clear />
    <add key="offline" value="https://127.0.0.1:4720/v3/index.json" />
  </packageSources>
</configuration>
EOF
dotnet restore 2>&1 | grep -oE "error NU1301: Unable to load the service index for source [^ ]+" | sort -u
exit "${PIPESTATUS[0]}"

Output · exit 1

--- nuget.org
error NU1101: Unable to find package Newtonsoft.Jsonn. No packages exist with this id in source(s): nuget.org
error NU1102: Unable to find package Newtonsoft.Json with version (>= 99.0.0)
--- a feed that does not answer
error NU1301: Unable to load the service index for source https://127.0.0.1:4720/v3/index.json.

Code table

CodeLevelMeaningUsual fix
NU1100ErrorUnable to resolve a dependency (often no sources configured)Check nuget.config and dotnet nuget list source
NU1101ErrorNo source has a package with this idFix the id or add the feed
NU1102ErrorThe package exists, but no version matches the rangeUse a version that exists
NU1103ErrorOnly prerelease versions match a stable rangeReference the prerelease explicitly
NU1107ErrorVersion conflict between two dependency pathsReference the package directly at a version both accept
NU1108ErrorCycle in the dependency graphRemove the circular reference
NU1202ErrorPackage not compatible with the target frameworkUse a package version that supports it, or change TargetFramework
NU1301ErrorUnable to load the service index for a source (network, TLS, auth)Check the URL, proxy and credentials, or disable the source
NU1603WarningThe exact lower bound was not found; a higher version was usedPin a version that exists
NU1605Warning (error by default in SDK projects)Detected package downgradeReference the higher version directly
NU1608WarningResolved version is outside a dependency constraintAlign versions or upgrade the dependent package
NU1701WarningPackage restored with a .NET Framework fallback targetLook for a package version built for your framework
NU1900WarningVulnerability data could not be downloadedCheck access to the audit source
NU1901 – NU1904WarningPackage with a known low, moderate, high or critical vulnerabilityUpgrade to a patched version

Promoting or silencing codes

App.csproj
<PropertyGroup>
  <!-- fail the build on high and critical vulnerabilities -->
  <WarningsAsErrors>$(WarningsAsErrors);NU1903;NU1904</WarningsAsErrors>
  <!-- accept a known framework fallback -->
  <NoWarn>$(NoWarn);NU1701</NoWarn>
</PropertyGroup>

Scope NoWarn to a single package with <PackageReference Include="X" Version="1.0.0" NoWarn="NU1701" /> instead of the whole project when possible.

Sources