chocolatey/choco · error · ApplicationException
A single template command must be listed. Please see the hel
Error message
A single template command must be listed. Please see the help menu for those commands
What it means
Thrown by ChocolateyTemplateCommand.ParseAdditionalArguments when more than one unparsed positional argument is passed to 'choco template'. The template command accepts exactly one subcommand verb (list, info); passing two or more positional tokens is ambiguous and rejected before subcommand parsing.
Source
Thrown at src/chocolatey/infrastructure.app/commands/ChocolateyTemplateCommand.cs:58
_templateService = templateService;
}
public void ConfigureArgumentParser(OptionSet optionSet, ChocolateyConfiguration configuration)
{
optionSet
.Add("n=|name=",
"The name of the template to get information about.",
option => configuration.TemplateCommand.Name = option.UnquoteSafe().ToLower());
// todo: #2570 Allow for templates from an external path? Requires #1477
}
public virtual void ParseAdditionalArguments(IList<string> unparsedArguments, ChocolateyConfiguration configuration)
{
// don't set configuration.Input or it will be passed to list
if (unparsedArguments.Count > 1)
{
throw new ApplicationException("A single template command must be listed. Please see the help menu for those commands");
}
var command = TemplateCommandType.Unknown;
var unparsedCommand = unparsedArguments.DefaultIfEmpty(string.Empty).FirstOrDefault();
Enum.TryParse(unparsedCommand, true, out command);
if (command == TemplateCommandType.Unknown)
{
if (!string.IsNullOrWhiteSpace(unparsedCommand))
{
this.Log().Warn("Unknown command {0}. Setting to list.".FormatWith(unparsedCommand));
}
command = TemplateCommandType.List;
}
configuration.TemplateCommand.Command = command;
}
View on GitHub (pinned to 0d5abdd10c)
Solutions
- Pass only a single template subcommand per invocation: 'choco template list' or 'choco template info'.
- For multiple operations, issue separate 'choco template' calls.
- Run 'choco template --help' to review accepted subcommands.
Example fix
// before choco template list info // after choco template list choco template info --name=mytemplate
Defensive patterns
Strategy: validation
Validate before calling
// Ensure only one positional subcommand
if (positionalArgs.Count(arg => !arg.StartsWith("-")) > 1)
{
Console.Error.WriteLine("Pass a single template subcommand (list or info).");
} Prevention
- Issue each template operation as a separate 'choco template <subcommand>' call.
- Validate argument count before invoking.
When it happens
Trigger: Running 'choco template list info' or any invocation with 2+ positional arguments. The check is unparsedArguments.Count > 1.
Common situations: User chains multiple template operations. Script misconfiguration passes extra positional args. User misunderstands CLI syntax.
Related errors
- A single pin command must be listed. Please see the help men
- A single sources command must be listed. Please see the help
- Multiple sources are not supported by push command.
- No '--order-by' clause was provided. Specify one of the supp
- When specifying the subcommand '{0}', you must also specify
AI-assisted analysis of chocolatey/choco@0d5abdd10c (2026-08-13).
Data as JSON: /api/errors/1defd96103c44756.
Report an issue: GitHub.