microsoft/aspire · error · ProjectUpdaterException
No package found with ID
Error message
No package found with ID '{packageId}' in channel '{context.Channel.Name}'. What it means
GetLatestVersionOfPackageAsync queries the configured package channel for the newest version of a package ID. When the channel returns no package and throwIfNotFound is true, it throws ProjectUpdaterException with NoPackageFoundFormat naming the package ID and channel; when throwIfNotFound is false it only logs a warning and returns null, letting the updater skip that package.
Solutions
- Check the package ID spelling against the project file — IDs are case-sensitive in some feeds.
- Verify the package exists on the channel's feed (open the feed URL / dotnet package search) and that the mirror is synced.
- Add the missing source (e.g. nuget.org) to the channel's NuGet.config, or switch to a channel that includes it.
- If the package is intentionally optional, use the non-throwing path so the updater logs a warning and skips it instead of failing the update.
Example fix
// before (feed missing the package) <packageSources><add key="internal-mirror" value="https://mirror.internal/limited/v3/index.json" /></packageSources> // after (add upstream) <packageSources><add key="internal-mirror" value="https://mirror.internal/limited/v3/index.json" /><add key="nuget" value="https://api.nuget.org/v3/index.json" /></packageSources>
Defensive patterns
Strategy: validation
Validate before calling
// Verify the package exists on the channel's feed before updating
var search = await dotnet.RunAsync($"package search {packageId} --source {feedUrl}");
if (search.ExitCode != 0 || string.IsNullOrWhiteSpace(search.Stdout))
throw new InvalidOperationException($"{packageId} not found on {feedUrl}"); Try / catch
try
{
var version = await updater.GetLatestVersionOfPackageAsync(packageId, context, throwIfNotFound: true, cancellationToken);
}
catch (ProjectUpdaterException ex) when (ex.Message.Contains("No package found"))
{
Console.Error.WriteLine($"{packageId} missing from channel; check feed config or ID spelling.");
} Prevention
- Use non-throwing lookup (log-and-skip) for optional packages in update automation.
- Keep channel feeds (nuget.org or a fully-synced mirror) reachable and current.
- Double-check package IDs — a typo surfaces as 'package not found'.
- Audit explicit channel NuGet.config sources to confirm they host all packages in the solution.
When it happens
Trigger: GetLatestVersionOfPackageAsync (used by latestSdkPackage/latestPackage flows) querying a channel whose package search yields no entry for the requested packageId, with throwIfNotFound=true — i.e. an explicit channel missing the package.
Common situations: Explicit channel configured with a narrow feed (staging mirror, pinned NuGet.config source) that does not host the package; typo in package ID; the package was renamed/unlisted upstream; offline or partially-synced mirror missing recent packages; version range filters excluding all published versions.
Related errors
- Failed to discover NuGet.config files.
- Failed to restore packages for project
- aspire-managed not found in layout.
- Bundle layout not found. Cannot perform NuGet restore in…
- Bundle layout not found. Cannot perform NuGet search in…
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/f6d842da5ed983a0.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Cli/Projects/ProjectUpdater.cs:395
private async Task<NuGetPackageCli?> GetLatestVersionOfPackageAsync(UpdateContext context, string packageId, bool throwIfNotFound = true, CancellationToken cancellationToken = default)
{
var cacheKey = $"LatestPackage-{packageId}";
var latestPackage = await cache.GetOrCreateAsync(cacheKey, async entry =>
{
var packages = await context.Channel.GetPackagesAsync(packageId, context.AppHostProjectFile.Directory!, cancellationToken);
// Filter out packages with invalid semantic versions and find the latest valid one
var latestPackage = packages
.Where(p => SemVersion.TryParse(p.Version, SemVersionStyles.Strict, out _))
.OrderByDescending(p => SemVersion.Parse(p.Version, SemVersionStyles.Strict), SemVersion.PrecedenceComparer)
.FirstOrDefault();
return latestPackage;
});
if (latestPackage is null)
{
if (throwIfNotFound)
{
throw new ProjectUpdaterException(string.Format(CultureInfo.InvariantCulture, UpdateCommandStrings.NoPackageFoundFormat, packageId, context.Channel.Name));
}
logger.LogWarning(UpdateCommandStrings.PackageNotFoundInChannelWarningFormat, packageId, context.Channel.Name);
return null;
}
return latestPackage;
}
private async Task AnalyzeAppHostSdkAsync(UpdateContext context, CancellationToken cancellationToken)
{
logger.LogDebug("Analyzing App Host SDK for: {AppHostFile}", context.AppHostProjectFile.FullName);
var itemsAndPropertiesDocument = await GetItemsAndPropertiesWithFallbackAsync(context.AppHostProjectFile, context, cancellationToken);
var propertiesElement = itemsAndPropertiesDocument.RootElement.GetProperty("Properties");
var sdkVersionElement = propertiesElement.GetProperty("AspireHostingSDKVersion");
var sdkVersion = sdkVersionElement.GetString();
View on GitHub (pinned to 25830f84bd)