Why it matters: If backend restore suddenly fails with NU1903 on all branches at once, look for a fresh security advisory before suspecting your own change.

Context

A repository with NuGet audit on and warnings treated as errors. Mid-day, a fresh worktree’s dotnet restore failed, and an unrelated open pull request started failing its build job at the same time. Nothing in the repository had changed.

The insight

With audit on and warnings as errors, dotnet restore fails the moment an advisory is published for any package in the dependency graph. That includes a transitive package that no project file references.

error NU1903: Warning As Error: Package '<name>' <version> has a known high severity vulnerability, <advisory URL>

How to recognise it:

  • The same error hits the main branch and every other branch at the same time.
  • It names a package that git grep cannot find in any .csproj or .props file.
Terminal window
git grep -n '<package name>' -- '*.csproj' '*.props' # no hit: the package is transitive
dotnet nuget why <solution-or-project> <package name> # shows which package pulls it in

The fix

Bump the parent package, or pin the transitive package centrally to a patched version. Do it once on the main branch, then rebase the other branches.

Second trap

A worktree setup recipe that chains restore, frontend install and tool linking aborts at the failed restore. The later steps never ran, and nothing says so afterwards. Once the restore works again, rerun those steps by hand.