Fixing NuGet Error: Unable to Load the Service Index for Source
You set up a new .NET project, run dotnet restore, and hit this:
Unable to load the service index for source https://pkgs.dev.azure.com/...
Restore stops. The wording is vague on purpose: NuGet could not GET the v3 service index (index.json) from that URL. The index is a small JSON document that lists search, package-content, and other resource URLs. If that GET fails — 401, DNS, TLS, timeout, 404 — you get this error and nothing else. Treat it as "I cannot read that feed's front door," then find which door.
Confirm the URL is a feed, then confirm you can reach it
dotnet nuget list source prints the sources restore will consult. dotnet nuget config paths prints the nuget.config files that were merged to produce that list. You want both. A source you thought you deleted in the repo config can still live in the user config.
dotnet nuget list source
dotnet nuget config paths
Open the failing URL in a browser. For nuget.org that is https://api.nuget.org/v3/index.json. For Azure Artifacts it looks like https://pkgs.dev.azure.com/{org}/{project}/_packaging/{feed}/nuget/v3/index.json. If the browser also fails, you are not looking at a NuGet bug yet.
A 401 or an Azure DevOps sign-in page means the URL is fine and credentials are not. A DNS error or a hang means network or proxy. An SSL warning means interception. A 404 means the feed name, project, or org in the URL is wrong — fix the config, do not install a credential provider for a feed that does not exist.
curl -I https://api.nuget.org/v3/index.json
curl -I "https://pkgs.dev.azure.com/org/project/_packaging/feed/nuget/v3/index.json"
curl -I will also 401 on a private feed. That is still useful: you reached the host.
Authentication is the usual cause on Azure Artifacts
Private feeds do not accept an anonymous GET of the service index. Visual Studio can pop an account picker. dotnet restore on a fresh agent, or on a laptop that has never talked to that org, will not. Install the Azure Artifacts Credential Provider and run one interactive restore so it can cache a token.
# Microsoft's install script (macOS / Linux). Windows: use the repo's install.ps1.
sh -c "$(curl -fsSL https://aka.ms/install-artifacts-credprovider.sh)"
dotnet nuget locals http-cache --clear
dotnet restore --interactive
--interactive lets the provider open a browser or a device-code prompt. After that, the token sits in the provider's cache until it expires. CI cannot open a browser. On Azure DevOps, the NuGet Authenticate task (or an equivalent that injects VSS_NUGET_EXTERNAL_FEED_ENDPOINTS) is how the same provider gets a token. A build that works on your laptop and fails on the agent with this error is almost always "no provider, or no token, on the agent."
See Consuming packages from authenticated feeds. A PAT in nuget.config as cleartext is a secret in git. Prefer the credential provider. If you must use a PAT on a locked-down agent, store it in the pipeline secret store.
401 after a successful interactive restore usually means the account can see the org but not the feed. Feed permissions are separate from project permissions.
nuget.config merge is how a dead source sneaks in
NuGet merges machine, user, and repo configs. A source in any of them is enough to make restore try that URL. The error names the source it could not load, which may not be the source you care about. A stale https://pkgs.dev.azure.com/OldOrg/... in ~/.nuget/NuGet/NuGet.Config will fail a restore that only needed nuget.org.
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="MyFeed" value="https://pkgs.dev.azure.com/org/project/_packaging/feed/nuget/v3/index.json" />
</packageSources>
Repo-level nuget.config should list the sources the repo actually uses, and often <clear /> inside <packageSources> so user-level junk cannot add a second Azure org you do not have a token for. <clear /> is sharp: it also drops nuget.org unless you add it back. That is usually what you want in a repo that restores from one private feed plus nuget.org.
disabledPackageSources can disable a source without deleting it. list source shows that. If a source is disabled and restore still names it, you are not looking at the config file you think you are — check config paths again, including a nuget.config in a parent directory.
Wrong protocol is a real config bug: http://api.nuget.org/v3/index.json may be blocked. Use the https index URL.
Proxy, TLS inspection, and "it works at home"
Behind a corporate proxy, NuGet needs the proxy in its own config, not only in the browser:
dotnet nuget config set http_proxy http://proxy.company.com:8080
dotnet nuget config set http_proxy.user YOUR_USERNAME
If curl -I https://api.nuget.org/v3/index.json fails in the same shell, fix the network before chasing credential providers.
TLS inspection that re-signs HTTPS with a corporate CA will fail NuGet unless that CA is in the machine trust store. dotnet dev-certs https --trust trusts the ASP.NET development certificate. It does not trust your company's intercepting proxy. Ask IT for the root CA and install it in the system store. Clock skew on a VM will also fail TLS.
The feed is actually down
Sometimes the GET fails because the service is down. Check Azure DevOps Status for Artifacts, and NuGet.org Status for nuget.org.
If a private feed is down, you can temporarily fall back to packages already in your local NuGet cache by removing the failing source from your nuget.config (so the restore only consults the remaining sources and the local cache). Pulling ~/.nuget/packages directly with --source does not work — that folder is the global packages folder, not a NuGet feed. --source expects a feed URL or a folder of .nupkg files laid out as a local feed, not the extracted global cache.
Diagnosis order
- Read the URL in the error. Browser GET. 404 means fix the URL. Sign-in page or 401 means auth. Hang or TLS error means network.
dotnet nuget list sourceanddotnet nuget config paths. Remove or disable sources you cannot authenticate to and do not need.dotnet restore --interactivewith the Artifacts Credential Provider, once, on a human-operated machine.- On CI, confirm the authenticate task (or
VSS_NUGET_EXTERNAL_FEED_ENDPOINTS) runs before restore, on the same user the restore runs as. curl -Ithe index from the same shell. Proxy and TLS show up here.- Status pages for nuget.org and Azure DevOps. If the feed is down, restore from remaining sources plus the local cache; do not point
--sourceat~/.nuget/packages. - Only then clear caches (
dotnet nuget locals http-cache --clear, thenallif you have evidence of a poisoned cache). Clearingalldeletes downloaded packages and makes the next restore heavier.
This error is usually credentials on a private feed, or a source in a merged nuget.config that you are not looking at. Start with the URL in the message. The rest of the restore is not running until that GET succeeds.
Keep reading
Data Protection Keys: The Cookie the Other Instance Could Not Read
Cookie auth, antiforgery, and TempData encrypt with the Data Protection key ring. The default ring is local. A second instance, a slot swap, or a recycled container mints a ring the first one never had.
IHttpClientFactory: Stop Creating HttpClient Per Request
Why new HttpClient() in a .NET service exhausts sockets under load, and how IHttpClientFactory plus a named client fixes DNS without freezing the handler forever.
IOptionsSnapshot: The Snapshot Your Singleton Froze
IOptionsSnapshot is scoped. Inject it into a singleton and Production will not throw. You get one snapshot, minted at first resolve, that ignores every reload.
EF Core ExecuteUpdate: SaveChanges Never Ran, and Neither Did Your Interceptor
ExecuteUpdate sends SQL now. It skips SaveChanges, the tracker, and your audit interceptor. Stamp columns in the SET, or the tracked entity lies.
Pass the CancellationToken or the Work Continues After the Client Left
ASP.NET Core binds CancellationToken to the aborted request. Forward it to EF Core and HttpClient, and do not turn a client disconnect into a 500.
Azure Functions vs Azure Container Apps: Choosing the Right Serverless Model
A detailed comparison of Azure Functions and Azure Container Apps — pricing, cold starts, scaling, runtime support, and a decision flowchart for picking the right one.
Newsletter
New posts, straight to your inbox
One email when a new post goes up. Double opt-in, unsubscribe anytime. Not a daily digest.
Comments
- No comments yet. Be the first.