microsoft/aspire · error · InvalidOperationException
Unknown publish summary scenario
Error message
Unknown publish summary scenario '{scenarioKey}'. What it means
RenderCommand's TestPublishSummary renderer switches over a hardcoded set of scenario keys to produce sample publish-summary output. An unrecognized scenarioKey hits the switch's default arm, which throws this InvalidOperationException because the scenario table is closed.
Solutions
- Use one of the supported scenario keys (check RenderCommand's switch in CreatePublishSummaryScenario)
- Fix the typo in the scenario argument
- If adding a new scenario, add the corresponding switch arm in CreatePublishSummaryScenario
Example fix
// before render --scenario publish-sucess // after render --scenario publish-success
Defensive patterns
Strategy: validation
Validate before calling
var known = new[] { "publish-success", "publish-failure", /* all supported keys */ };
if (!known.Contains(scenarioKey))
throw new ArgumentException($"Unknown scenario '{scenarioKey}'."); Try / catch
try { RenderPublishSummary(scenarioKey); }
catch (InvalidOperationException ex) when (ex.Message.StartsWith("Unknown publish summary scenario")) { Console.Error.WriteLine("Supported: <list keys>"); } Prevention
- List available scenario keys in help output
- Use constants/enum instead of raw strings for scenario keys
- Add a test that iterates all documented scenario keys
When it happens
Trigger: Invoking the internal render/preview entry point (e.g. `aspire render ...` developer/scenario flag) with a scenario name that is not one of the defined publish-summary scenarios.
Common situations: Typo in a scenario key on the command line; contributor added a scenario caller without adding the matching switch arm; stale docs listing a removed scenario.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- MarkdownShowcase.txt embedded resource not found.
- Already connected to AppHost backchannel.
- Already connected to
- AppHost is incompatible with the CLI. The AppHost must be…
- Aspire Extension is incompatible with the CLI. The…
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/b46308a35f56cda1.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Cli/Commands/RenderCommand.cs:551
]),
"publish-summary-markdown-values" => new(
"Markdown in pipeline summary values",
[
new("root", "Deploy to Azure", ConsoleActivityLogger.ActivityState.Success, TimeSpan.FromSeconds(30), null, null, 0, 1, TimeSpan.Zero, TimeSpan.FromSeconds(30)),
new("provision", "Provision resources", ConsoleActivityLogger.ActivityState.Success, TimeSpan.FromSeconds(18), null, "root", 1, 2, TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(20)),
new("configure", "Configure endpoints", ConsoleActivityLogger.ActivityState.Success, TimeSpan.FromSeconds(8), null, "root", 1, 3, TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(28)),
],
PipelineSummary:
[
new() { Key = "Endpoint", Value = "Application deployed to [https://myapp.azurecontainerapps.io](https://myapp.azurecontainerapps.io)", EnableMarkdown = true },
new() { Key = "Dashboard", Value = "View resources at [Azure Portal](https://portal.azure.com/#view/resource/123)", EnableMarkdown = true },
new() { Key = "API Docs", Value = "See the **API reference** at [docs](https://learn.microsoft.com/aspire) for more info", EnableMarkdown = true },
new() { Key = "Connection String", Value = "`Server=tcp:myserver.database.windows.net;Database=mydb`", EnableMarkdown = true },
new() { Key = "Region", Value = "East US 2", EnableMarkdown = false },
new() { Key = "Resource Group", Value = "rg-myapp-prod", EnableMarkdown = false },
new() { Key = "Next Steps", Value = "Run `aspire publish --env staging` to deploy to **staging**, or visit [the docs](https://learn.microsoft.com/aspire/deployment) for more options.", EnableMarkdown = true },
]),
_ => throw new InvalidOperationException($"Unknown publish summary scenario '{scenarioKey}'.")
};
private sealed record PublishSummaryRenderScenario(
string Title,
IReadOnlyList<ConsoleActivityLogger.StepDurationRecord> Records,
bool Succeeded = true,
IReadOnlyList<BackchannelPipelineSummaryItem>? PipelineSummary = null);
private TestPipelineCommand CreateTestPipelineCommand() => new(
_serviceProvider.GetRequiredService<IDotNetCliRunner>(),
_serviceProvider.GetRequiredService<IProjectLocator>(),
_serviceProvider.GetRequiredService<IFeatures>(),
_hostEnvironment,
_serviceProvider.GetRequiredService<IAppHostProjectFactory>(),
_serviceProvider.GetRequiredService<IConfiguration>(),
_serviceProvider.GetRequiredService<ILogger<RenderCommand>>(),
_ansiConsole,
_serviceProvider.GetRequiredService<CommonCommandServices>());View on GitHub (pinned to 25830f84bd)