microsoft/aspire · error · InvalidOperationException

This prompt requires interactive input but the CLI is…

Error message

This prompt requires interactive input but the CLI is running in non-interactive mode. This operation does not yet support non-interactive execution.

What it means

PromptForStringAsync collects free-text input via an interactive console prompt. When the CLI host environment is non-interactive, the method first tries the bound non-interactive default value; if none is bound, it throws the interactive-input-not-supported error because a required string cannot be obtained without a user at the terminal.

Solutions

  1. Pass the corresponding command-line option so the prompt binding resolves a value without interaction.
  2. Set a non-interactive default value on the prompt binding.
  3. Run the command in a real terminal instead of a non-interactive shell/CI job.
  4. Catch NonInteractiveException and abort with a message telling the user which option to supply.

Example fix

// before
aspire run   # prompts for a value in CI
// after
aspire run --project ./AppHost.csproj   # supply the option so no prompt is needed
Defensive patterns

Strategy: validation

Validate before calling

if (!hostEnvironment.SupportsInteractiveOutput && string.IsNullOrEmpty(options.ProjectPath))
{
    throw new NonInteractiveException("--project");
}

Try / catch

try { var value = await interaction.PromptForStringAsync(prompt, binding); }
catch (NonInteractiveException ex)
{
    return ExitCodeConstants.InvalidCommandUsage; // tell user to pass the option
}

Prevention

When it happens

Trigger: Calling PromptForStringAsync (directly or via PromptForFilePathAsync) in non-interactive mode (CI, piped stdin, --non-interactive flag) where the prompt's symbol has no non-interactive default value or corresponding command-line option supplied.

Common situations: Running an Aspire CLI command in CI without passing the option that backs the prompt; scripting the CLI with stdin redirected from /dev/null; forgetting the default value binding for a prompted setting.

Related errors


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

Appendix: source

Thrown at src/Aspire.Cli/Interaction/ConsoleInteractionService.cs:242

        {
            ValidateResolvedStringValue(value, required, validator, binding!.SymbolDisplayName);
            return value;
        }

        if (!_hostEnvironment.SupportsInteractiveInput)
        {
            if (binding != null)
            {
                if (binding.NonInteractiveDefaultValue != null)
                {
                    ValidateResolvedStringValue(binding.NonInteractiveDefaultValue, required, validator, binding.SymbolDisplayName);
                    return binding.NonInteractiveDefaultValue;
                }

                ThrowNonInteractiveError(binding.SymbolDisplayName);
            }

            throw new InvalidOperationException(InteractionServiceStrings.InteractiveInputNotSupported);
        }

        // Buffer console logs while interactive prompts are active so
        // background debug output doesn't drown the prompt UI.
        using var promptScope = _logBufferContext.BeginInteractivePromptScope();

        MessageLogger.LogInformation("Prompt: {PromptText} (default: {DefaultValue}, secret: {IsSecret})", promptText, isSecret ? "****" : defaultValue ?? "(none)", isSecret);

        var displayDefaultValue = defaultValue?.EscapeMarkup();

        var prompt = new TextPrompt<string>(promptText)
        {
            IsSecret = isSecret,
            AllowEmpty = !required
        };

        if (displayDefaultValue != null)
        {

View on GitHub (pinned to 25830f84bd)