Unable to resolve package source '...' caused by stale HTTP cache
0 reputation · 02 Apr 2022, 06:22 UTC
Goal
Identify whether a stale HTTP cache entry is the root cause of the generic “Unable to resolve package source ‘…’” error emitted during a restore.
Constraints
NuGet caches metadata responses under %userprofile%\.nuget\cache, keyed by URL and retaining ETag/Last‑Modified headers when supplied. When a source omits or modifies Cache‑Control headers, the client may serve a stale file even if newer metadata exists. The behavior also varies between the NuGet CLI and the .NET SDK.
Uncertainty
The current design does not specify whether the client should honor Cache‑Control:max‑age directives or always re‑validate with If‑None‑Match/If‑Modified‑Since. This ambiguity leads to inconsistent cache freshness and may trigger the “Unable to resolve package source” message.
Questions
- When does NuGet skip re‑validation for package metadata requests?
- Do the CLI and SDK differ in their cache‑validation strategy for the same endpoint?
- What configuration can force re‑validation without disabling caching entirely?