microsoft/aspire · error · InvalidOperationException
Cannot complete step: Reporter is not set.
Error message
Cannot complete step: Reporter is not set.
What it means
ReportingStep.CompleteAsync(string, CompletionState, CancellationToken) throws InvalidOperationException when Reporter is null. Completing a step requires forwarding the completion text and state to the reporter; without one the step cannot report completion. The step must be wired to a reporter for its whole lifetime.
Solutions
- Create and complete the step through the pipeline infrastructure so Reporter is always attached.
- Assign a valid reporter before calling CompleteAsync.
- Guard on Reporter is null before completing, or use a try/finally with a reporter-availability check.
- In tests, register a fake reporter implementation.
Example fix
// before
await step.CompleteAsync("Deployment finished", CompletionState.Completed);
// after
if (step.Reporter is null)
{
throw new InvalidOperationException("Attach a reporter to the step before completing it.");
}
await step.CompleteAsync("Deployment finished", CompletionState.Completed); Defensive patterns
Strategy: type-guard
Validate before calling
if (step.Reporter is null)
{
throw new InvalidOperationException("Step has no reporter; cannot complete.");
} Type guard
bool canComplete = step.Reporter is not null;
Try / catch
try
{
await step.CompleteAsync(completionText, state);
}
catch (InvalidOperationException ex) when (ex.Message.Contains("Reporter is not set"))
{
logger.LogError(ex, "Step completion skipped: no reporter attached.");
} Prevention
- Complete steps within the same pipeline context that created them.
- Avoid caching ReportingStep objects beyond pipeline lifetime.
- Use pipeline-managed completion instead of manual CompleteAsync calls.
When it happens
Trigger: Calling await step.CompleteAsync("Done", CompletionState.Completed) on a ReportingStep whose Reporter property was never assigned or has been cleared.
Common situations: Manually constructed steps in tests, custom pipeline code completing steps after pipeline context teardown, or steps created outside the standard pipeline API.
Understand the failure class
Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.
Related errors
- Cannot create task: Reporter is not set.
- Value cannot be null. (Parameter 'key')
- Value cannot be null. (Parameter 'value')
- Cannot complete task
- Cannot create task for step
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/90acacb8d1e2e7b9.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Hosting/Pipelines/ReportingStep.cs:171
/// <inheritdoc />
public void Log(LogLevel logLevel, MarkdownString message)
{
ArgumentNullException.ThrowIfNull(message);
if (Reporter is null)
{
return;
}
Reporter.Log(this, logLevel, message.Value, enableMarkdown: true);
}
/// <inheritdoc />
public async Task CompleteAsync(string completionText, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
{
if (Reporter is null)
{
throw new InvalidOperationException("Cannot complete step: Reporter is not set.");
}
await Reporter.CompleteStepAsync(this, completionText, completionState, enableMarkdown: false, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <inheritdoc />
public async Task CompleteAsync(MarkdownString completionText, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default)
{
ArgumentNullException.ThrowIfNull(completionText);
if (Reporter is null)
{
throw new InvalidOperationException("Cannot complete step: Reporter is not set.");
}
await Reporter.CompleteStepAsync(this, completionText.Value, completionState, enableMarkdown: true, cancellationToken: cancellationToken).ConfigureAwait(false);
}
View on GitHub (pinned to 25830f84bd)