{"record":{"id":"3150ff00106e0df0","repo":"microsoft/aspire","slug":"this-prompt-requires-interactive-input-but-the-cli-is","errorCode":null,"errorMessage":"This prompt requires interactive input but the CLI is running in non-interactive mode. This operation does not yet support non-interactive execution.","messagePattern":"This prompt requires interactive input but the CLI is running in non-interactive mode\\. This operation does not yet support non-interactive execution\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Cli/Interaction/ConsoleInteractionService.cs","lineNumber":242,"sourceCode":"        {\n            ValidateResolvedStringValue(value, required, validator, binding!.SymbolDisplayName);\n            return value;\n        }\n\n        if (!_hostEnvironment.SupportsInteractiveInput)\n        {\n            if (binding != null)\n            {\n                if (binding.NonInteractiveDefaultValue != null)\n                {\n                    ValidateResolvedStringValue(binding.NonInteractiveDefaultValue, required, validator, binding.SymbolDisplayName);\n                    return binding.NonInteractiveDefaultValue;\n                }\n\n                ThrowNonInteractiveError(binding.SymbolDisplayName);\n            }\n\n            throw new InvalidOperationException(InteractionServiceStrings.InteractiveInputNotSupported);\n        }\n\n        // Buffer console logs while interactive prompts are active so\n        // background debug output doesn't drown the prompt UI.\n        using var promptScope = _logBufferContext.BeginInteractivePromptScope();\n\n        MessageLogger.LogInformation(\"Prompt: {PromptText} (default: {DefaultValue}, secret: {IsSecret})\", promptText, isSecret ? \"****\" : defaultValue ?? \"(none)\", isSecret);\n\n        var displayDefaultValue = defaultValue?.EscapeMarkup();\n\n        var prompt = new TextPrompt<string>(promptText)\n        {\n            IsSecret = isSecret,\n            AllowEmpty = !required\n        };\n\n        if (displayDefaultValue != null)\n        {","sourceCodeStart":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Cli/Interaction/ConsoleInteractionService.cs#L224-L260","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass the corresponding command-line option so the prompt binding resolves a value without interaction.","Set a non-interactive default value on the prompt binding.","Run the command in a real terminal instead of a non-interactive shell/CI job.","Catch NonInteractiveException and abort with a message telling the user which option to supply."],"exampleFix":"// before\naspire run   # prompts for a value in CI\n// after\naspire run --project ./AppHost.csproj   # supply the option so no prompt is needed","handlingStrategy":"validation","validationCode":"if (!hostEnvironment.SupportsInteractiveOutput && string.IsNullOrEmpty(options.ProjectPath))\n{\n    throw new NonInteractiveException(\"--project\");\n}","typeGuard":null,"tryCatchPattern":"try { var value = await interaction.PromptForStringAsync(prompt, binding); }\ncatch (NonInteractiveException ex)\n{\n    return ExitCodeConstants.InvalidCommandUsage; // tell user to pass the option\n}","preventionTips":["Always pass CLI options that back prompts when scripting.","Set non-interactive defaults on prompt bindings.","Test commands under CI with non-interactive mode enabled.","Run interactive-only commands from a real terminal."],"tags":["cli","non-interactive","prompt","ci"],"backgroundTag":"authentication-required","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"}