chocolatey/choco · error · ApplicationException

A single feature command must be listed. Please see the help

Error message

A single feature command must be listed. Please see the help menu for those commands.

What it means

The feature command allows a single positional subcommand/argument. ParseAdditionalArguments throws when unparsedArguments.Count > 1 while the command is List or a name was already resolved, because multiple leftover positional tokens are ambiguous. It points to the help menu for valid feature commands (list/enable/disable).

Source

Thrown at src/chocolatey/infrastructure.app/commands/ChocolateyFeatureCommand.cs:77

            Enum.TryParse(unparsedCommand, true, out command);
            if (command == FeatureCommandType.Unknown)
            {
                if (!string.IsNullOrWhiteSpace(unparsedCommand))
                {
                    this.Log().Warn("Unknown command {0}. Setting to list.".FormatWith(unparsedCommand));
                }

                command = FeatureCommandType.List;
            }

            configuration.FeatureCommand.Command = command;

            if ((configuration.FeatureCommand.Command == FeatureCommandType.List
                 || !string.IsNullOrWhiteSpace(configuration.FeatureCommand.Name)
                )
                && unparsedArguments.Count > 1)
            {
                throw new ApplicationException("A single feature command must be listed. Please see the help menu for those commands.");
            }

            if (string.IsNullOrWhiteSpace(configuration.FeatureCommand.Name) && unparsedArguments.Count >= 2)
            {
                configuration.FeatureCommand.Name = unparsedArguments[1];
            }
        }

        public virtual void Validate(ChocolateyConfiguration configuration)
        {
            if (configuration.FeatureCommand.Command != FeatureCommandType.List && string.IsNullOrWhiteSpace(configuration.FeatureCommand.Name))
            {
                throw new ApplicationException("When specifying the subcommand '{0}', you must also specify --name.".FormatWith(configuration.FeatureCommand.Command.ToStringSafe().ToLower()));
            }
        }

        public virtual void HelpMessage(ChocolateyConfiguration configuration)
        {

View on GitHub (pinned to 0d5abdd10c)

Solutions

  1. Pass a single feature subcommand with one --name: 'choco feature enable -n <feature>'.
  2. Enable/disable features one at a time rather than batching.
  3. Run 'choco feature -?' to confirm the supported subcommands.

Example fix

# before
choco feature enable -n useFipsCompliantChecksums -n allowGlobalConfirmation

# after
choco feature enable -n useFipsCompliantChecksums
choco feature enable -n allowGlobalConfirmation
Defensive patterns

Strategy: validation

Validate before calling

// Feature command: single positional argument max.
var positional = tokens.Where(t => !t.StartsWith("-")).ToList();
if (positional.Count > 1)
{
    throw new ArgumentException("feature: too many positional arguments");
}

Prevention

When it happens

Trigger: Running 'choco feature enable extra', 'choco feature disable name extra', or any feature invocation leaving more than one unparsed positional token.

Common situations: Passing multiple feature names; scripting that concatenates arguments; stray positional tokens from misquoted strings.

Related errors


AI-assisted analysis of chocolatey/choco@0d5abdd10c (2026-08-13). Data as JSON: /api/errors/b31c9eb6da00b674. Report an issue: GitHub.