Skip to content
Latchkey

NuGet "The local source ... doesn't exist" in CI

A configured source points at a local directory (a folder feed for pre-built packages), and that directory does not exist on the runner. NuGet cannot enumerate packages from a path that is not there.

What this error means

Restore fails immediately complaining the local source path "doesn’t exist", naming the directory from NuGet.config. It is deterministic and tied to a path that is present on a developer machine but missing in CI.

dotnet restore output
error : The local source '/home/runner/work/app/local-packages' doesn't exist.

Common causes

Folder feed path not produced in CI

A <add value="./local-packages" /> source assumes a directory of .nupkg files that an earlier step (a dotnet pack) was supposed to create but did not, or that only exists locally.

Absolute or machine-specific path in NuGet.config

A committed config with an absolute developer path (or a mount that only exists on one machine) cannot resolve on the runner’s filesystem.

How to fix it

Create the local feed before restore

If the local source is meant to hold packed packages, produce them first so the directory exists.

Terminal
mkdir -p ./local-packages
dotnet pack -c Release -o ./local-packages
dotnet restore

Use a repo-relative path or remove the source

Reference the folder feed by a relative path that exists in the checkout, or drop the source if it is not needed in CI.

NuGet.config
<packageSources>
  <add key="local" value="./local-packages" />
</packageSources>

How to prevent it

  • Use repo-relative folder-feed paths, never absolute developer paths.
  • Produce any local feed contents in an earlier CI step before restore.
  • Drop developer-only local sources from the committed NuGet.config.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →