microsoft/aspire · error · NonInteractiveException

The option must be specified when running in…

Error message

The {0} option must be specified when running in non-interactive mode.

What it means

Thrown by `aspire update --self` when running with --non-interactive (e.g. in CI) and no --channel option was supplied while the CLI's own identity channel cannot be used to pick an update channel. The CLI refuses to prompt, so it fails fast with a NonInteractiveException telling the user which option is required.

Solutions

  1. Add --channel stable (or daily/staging) to the non-interactive update command
  2. Run the command interactively so the channel prompt is shown
  3. Set the `channel` global configuration value so a prompt is not needed
  4. Ensure the CLI itself is an official build whose identity channel (stable/daily) can be used automatically

Example fix

// before
aspire update --self --non-interactive
// after
aspire update --self --non-interactive --channel stable
Defensive patterns

Strategy: validation

Validate before calling

if (isCi && !args.Contains("--channel"))
    throw new ArgumentException("--channel is required when running aspire update --self in non-interactive CI");

Try / catch

try { await selfUpdateAsync(); }
catch (NonInteractiveException ex) { Console.Error.WriteLine($"Provide the {ex.Message} or run interactively."); return 2; }

Prevention

When it happens

Trigger: `aspire update --self --non-interactive` (or non-TTY/CI environment forcing non-interactive) without --channel, when the running CLI's identity channel is empty, unrecognized, or an unmapped value like a local dev build in an unexpected configuration.

Common situations: CI pipelines upgrading the CLI non-interactively after the CLI was built locally or from a PR channel, scripts that previously relied on interactive prompting, or automation running through a non-TTY agent.

Understand the failure class

Background: "Must pass :limit option" / "Missing required option" — required option errors explained — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at src/Aspire.Cli/Commands/UpdateCommand.cs:699

            if (nonInteractive)
            {
                var identityChannel = ExecutionContext.IdentityChannel;
                if (!string.IsNullOrWhiteSpace(identityChannel)
                    && !string.Equals(identityChannel, PackageChannelNames.Local, StringComparisons.ChannelName)
                    && channels.FirstOrDefault(c => string.Equals(c, identityChannel, StringComparisons.ChannelName)) is { } matchedChannel)
                {
                    channel = matchedChannel;
                }
                else if (string.Equals(identityChannel, PackageChannelNames.Local, StringComparisons.ChannelName))
                {
                    channel = PackageChannelNames.Stable;
                }
                else
                {
                    var channelOptionDisplayName = $"'{_channelOption.Name}'";
                    InteractionService.DisplayError(
                        string.Format(CultureInfo.CurrentCulture, InteractionServiceStrings.NonInteractiveOptionRequired, channelOptionDisplayName));
                    throw new NonInteractiveException(channelOptionDisplayName);
                }
            }
            else
            {
                var channelBinding = PromptBinding.Create(parseResult, _channelOption);
                channel = await InteractionService.PromptForSelectionAsync(
                    "Select the channel to update to:",
                    channels,
                    q => q,
                    binding: channelBinding,
                    cancellationToken: cancellationToken);
            }
        }

        try
        {
            // Get current executable path for display purposes only
            var currentExePath = _processPathProvider.ProcessPath;

View on GitHub (pinned to 25830f84bd)