chocolatey/choco · error · ApplicationException
When specifying the subcommand '{0}', you must also specify
Error message
When specifying the subcommand '{0}', you must also specify --name. What it means
Validate() requires a feature name for any feature subcommand other than List. If FeatureCommand.Command != List and configuration.FeatureCommand.Name is blank, it throws, naming the offending subcommand. enable/disable need to know which feature to toggle.
Source
Thrown at src/chocolatey/infrastructure.app/commands/ChocolateyFeatureCommand.cs:90
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)
{
this.Log().Info(ChocolateyLoggers.Important, "Feature Command");
this.Log().Info(@"
Chocolatey will allow you to interact with features.
");
"chocolatey".Log().Info(ChocolateyLoggers.Important, "Usage");
"chocolatey".Log().Info(@"
choco feature [list]|disable|enable [<options/switches>]
");
"chocolatey".Log().Info(ChocolateyLoggers.Important, "Examples");
"chocolatey".Log().Info(@"
choco feature
View on GitHub (pinned to 0d5abdd10c)
Solutions
- Add --name <feature> (or a positional name): 'choco feature disable -n checkSumFiles'.
- Run 'choco feature list' to discover valid feature names first.
- Quote names containing dashes to avoid flag interpretation.
Example fix
# before choco feature enable # after choco feature enable --name useEnhancedExitCodes
Defensive patterns
Strategy: validation
Validate before calling
// Non-list feature subcommands require a name.
if (featureVerb != "list" && string.IsNullOrWhiteSpace(featureName))
{
throw new InvalidOperationException($"feature {featureVerb} requires --name");
} Prevention
- Always pass --name for enable/disable.
- Quote feature names containing dashes.
When it happens
Trigger: Running 'choco feature enable' or 'choco feature disable' without --name and without a positional name token.
Common situations: Forgetting the feature name; assuming a bare subcommand toggles all features; the name token getting parsed as a flag.
Related errors
- When specifying the subcommand '{0}', you must also specify
- A single feature command must be listed. Please see the help
- Name is required. Please pass in a name for the new package.
- A single apikey command must be listed. Please see the help
- You must specify 'source' to remove an API key.
AI-assisted analysis of chocolatey/choco@0d5abdd10c (2026-08-13).
Data as JSON: /api/errors/cf02b6a810e40316.
Report an issue: GitHub.