microsoft/aspire · error · DistributedApplicationException
The '--output-path [path]' option was not specified even…
Error message
The '--output-path [path]' option was not specified even though '--publisher manifest' argument was used.
What it means
The manifest publisher writes the distributed application model to a JSON manifest file and therefore requires an output path. PublishInternalAsync checks the configured OutputPath first and throws DistributedApplicationException if it is null, echoing the CLI option ('--output-path') that should have supplied it.
Solutions
- Pass --output-path <path> when using --publisher manifest.
- If invoking programmatically, set OutputPath in the publisher options before calling PublishAsync.
- Check the config source (env vars/args) bound to OutputPath is actually present.
Example fix
// before dotnet run --publisher manifest // after dotnet run --publisher manifest --output-path ./manifest.json
Defensive patterns
Strategy: validation
Validate before calling
if (string.IsNullOrWhiteSpace(publisherOptions.OutputPath))
{
throw new InvalidOperationException("--output-path is required with --publisher manifest.");
} Type guard
bool HasOutputPath(ManifestPublisherOptions? o) => !string.IsNullOrWhiteSpace(o?.OutputPath);
Try / catch
try
{
await publisher.PublishAsync(model, ct);
}
catch (DistributedApplicationException ex) when (ex.Message.Contains("--output-path"))
{
logger.LogError(ex, "Manifest publishing requires --output-path.");
} Prevention
- Always pass --output-path when using --publisher manifest.
- Add a CLI wrapper that fails fast on missing required flags.
- Bind OutputPath in tests to a temp directory to catch config gaps.
When it happens
Trigger: Running the publisher in manifest mode ('--publisher manifest') via PublishAsync without setting --output-path, or invoking ManifestPublisher programmatically with an options object whose OutputPath is null.
Common situations: Forgetting the --output-path flag on 'aspire publish' / dotnet run --publisher manifest; configuration binding not populating OutputPath; calling the publisher API directly from tests or tooling without options.
Understand the failure class
Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.
Related errors
- The '--output-path [path]' option was not specified even…
- Could not get directory name of output path
- Could not get the container image name for resource
- Downloaded Aspire skills package does not contain…
- Integration closure manifest file
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/4825d4316a1607ec.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Hosting/Publishing/ManifestPublisher.cs:33
IOptions<PublishingOptions> options,
DistributedApplicationExecutionContext executionContext) : IDistributedApplicationPublisher
{
private readonly ILogger<ManifestPublisher> _logger = logger;
private readonly IOptions<PublishingOptions> _options = options;
private readonly DistributedApplicationExecutionContext _executionContext = executionContext;
public Utf8JsonWriter? JsonWriter { get; set; }
public async Task PublishAsync(DistributedApplicationModel model, CancellationToken cancellationToken)
{
await PublishInternalAsync(model, cancellationToken).ConfigureAwait(false);
}
protected virtual async Task PublishInternalAsync(DistributedApplicationModel model, CancellationToken cancellationToken)
{
if (_options.Value.OutputPath == null)
{
throw new DistributedApplicationException(
"The '--output-path [path]' option was not specified even though '--publisher manifest' argument was used."
);
}
if (!_options.Value.OutputPath.EndsWith(".json", StringComparison.Ordinal))
{
// If the manifest path ends with .json we assume that the output path was specified
// as a filename. If not, we assume that the output path was specified as a directory
// and append aspire-manifest.json to the path. This is so that we retain backwards
// compatibility with AZD, but also support manifest publishing via the Aspire CLI
// where the output path is a directory (since not all publishers use a manifest).
_options.Value.OutputPath = Path.Combine(_options.Value.OutputPath, "aspire-manifest.json");
}
var parentDirectory = Directory.GetParent(_options.Value.OutputPath);
if (!Directory.Exists(parentDirectory!.FullName))
{
// Create the directory if it does not existView on GitHub (pinned to 25830f84bd)