microsoft/aspire · error · EmptyChoicesException

No template versions were found. Please check your internet…

Error message

No template versions were found. Please check your internet connection or NuGet source configuration.

What it means

Thrown by ResolveTemplatePackageAsync when the channel/source enumeration returns zero Aspire.ProjectTemplates packages at all. This usually means the CLI could not reach or read any NuGet source, so no template versions could be discovered.

Solutions

  1. Check network connectivity and retry.
  2. Verify NuGet source configuration (nuget.org or your internal mirror) and credentials.
  3. Point ASPIRE_CLI_PACKAGES at a directory containing staged packages to use local resolution.
  4. Add an explicit reachable source with --source.

Example fix

// before
# sources unreachable, empty package list
// after
curl -I https://api.nuget.org/v3/index.json   # verify connectivity
aspire new --source https://api.nuget.org/v3/index.json
Defensive patterns

Strategy: retry

Validate before calling

using var ping = new HttpClient();
var ok = await ping.GetAsync("https://api.nuget.org/v3/index.json") is { IsSuccessStatusCode: true };

Try / catch

try { await ResolveTemplatePackageAsync(...); }
catch (EmptyChoicesException) { // check network/nuget sources, then retry with backoff
}

Prevention

When it happens

Trigger: Resolving template packages when every configured feed returns an empty package list — all sources unreachable, misconfigured sources, or credential failures that silently yield no packages.

Common situations: No internet connection; corporate proxy blocking nuget.org; NuGet.config pointing only at unreachable internal feeds; expired feed credentials; ASPIRE_CLI_PACKAGES directory empty.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16). Data as JSON: /api/errors/c256050a0f7cd0df. Report an issue: GitHub.

Appendix: source

Thrown at src/Aspire.Cli/Templating/TemplateNuGetConfigService.cs:363

        if (query.VersionOverride is { } version)
        {
            var explicitMatch = orderedPackagesFromChannels.FirstOrDefault(p =>
                string.Equals(p.Package.Version, version, StringComparison.OrdinalIgnoreCase));
            if (explicitMatch.Package is not null)
            {
                return new TemplatePackageSelection(explicitMatch.Package, explicitMatch.Channel);
            }

            throw new EmptyChoicesException(
                string.Format(
                    CultureInfo.CurrentCulture,
                    Resources.TemplatingStrings.TemplateVersionNotFound,
                    version));
        }

        if (!packagesFromChannels.Any())
        {
            throw new EmptyChoicesException(Resources.TemplatingStrings.NoTemplateVersionsFound);
        }

        if (VersionHelper.TryGetCurrentCliVersionMatch(
            orderedPackagesFromChannels,
            p => p.Package.Version,
            executionContext.IdentitySdkVersion,
            out var cliVersionMatch,
            channelName: query.RequestedChannel,
            hasPrHives: hasPrHives))
        {
            return new TemplatePackageSelection(cliVersionMatch.Package, cliVersionMatch.Channel);
        }

        // If channel was specified via --channel option or per-project aspire.config.json
        // (but no --version), automatically select the highest version from that channel
        // without prompting.
        if (!string.IsNullOrEmpty(query.RequestedChannel))
        {

View on GitHub (pinned to 25830f84bd)