{"record":{"id":"51de6e6cb4bc732c","repo":"microsoft/aspire","slug":"template-version-0-was-not-found","errorCode":null,"errorMessage":"Template version '{0}' was not found.","messagePattern":"Template version '(.+?)' was not found\\.","errorType":"exception","errorClass":"EmptyChoicesException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Cli/Templating/TemplateNuGetConfigService.cs","lineNumber":354,"sourceCode":"                        Resources.TemplatingStrings.NoMatchingLocalTemplatePackage,\n                        executionContext.IdentitySdkVersion));\n            }\n\n            return new TemplatePackageSelection(localMatch.Package, localMatch.Channel);\n        }\n\n        var orderedPackagesFromChannels = packagesFromChannels.OrderByDescending(p => Semver.SemVersion.Parse(p.Package.Version), Semver.SemVersion.PrecedenceComparer);\n\n        if (query.VersionOverride is { } version)\n        {\n            var explicitMatch = orderedPackagesFromChannels.FirstOrDefault(p =>\n                string.Equals(p.Package.Version, version, StringComparison.OrdinalIgnoreCase));\n            if (explicitMatch.Package is not null)\n            {\n                return new TemplatePackageSelection(explicitMatch.Package, explicitMatch.Channel);\n            }\n\n            throw new EmptyChoicesException(\n                string.Format(\n                    CultureInfo.CurrentCulture,\n                    Resources.TemplatingStrings.TemplateVersionNotFound,\n                    version));\n        }\n\n        if (!packagesFromChannels.Any())\n        {\n            throw new EmptyChoicesException(Resources.TemplatingStrings.NoTemplateVersionsFound);\n        }\n\n        if (VersionHelper.TryGetCurrentCliVersionMatch(\n            orderedPackagesFromChannels,\n            p => p.Package.Version,\n            executionContext.IdentitySdkVersion,\n            out var cliVersionMatch,\n            channelName: query.RequestedChannel,\n            hasPrHives: hasPrHives))","sourceCodeStart":336,"sourceCodeEnd":372,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Cli/Templating/TemplateNuGetConfigService.cs#L336-L372","documentation":"Thrown by ResolveTemplatePackageAsync when an explicit template --version was requested but no Aspire.ProjectTemplates package with that exact version string exists on any configured channel/source. The comparison is an exact ordinal string match on the package version.","triggerScenarios":"Calling template resolution with an explicit version (via --version or equivalent API) that no available package matches — typo, unpublished version, or a version not present on the configured feeds.","commonSituations":"Typo in the version string; pinning a version only published to a feed not configured in NuGet.config; requesting a version newer than any staged/published package; offline feeds.","solutions":["List available versions (aspire search / check the feed) and use an exact existing version string.","Add the NuGet source that contains the requested version with --source or NuGet.config.","Drop the explicit --version to let the CLI pick the latest matching version.","Check for typos or extra whitespace in the version argument."],"exampleFix":"// before\naspire new --version 9.4.99   # not published\n// after\naspire new --version 9.4.0    # an existing published version (or omit --version)","handlingStrategy":"validation","validationCode":"// validate the requested version exists before resolution\nvar available = await packagingService.GetTemplatePackageVersionsAsync(ct);\nif (!available.Contains(requestedVersion, StringComparer.OrdinalIgnoreCase))\n{\n    throw new ArgumentException($\"Version {requestedVersion} not available. Available: {string.Join(\", \", available)}\");\n}","typeGuard":null,"tryCatchPattern":"try { await ResolveTemplatePackageAsync(...); }\ncatch (EmptyChoicesException) { // prompt user or retry with latest version\n}","preventionTips":["Copy version strings from feed listings instead of typing them.","Enumerate available versions before pinning one in scripts.","Confirm the feed containing the version is configured in NuGet.config."],"tags":["cli","nuget","version-not-found","templates"],"backgroundTag":"record-not-found","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T09:17:21.228Z"}