chocolatey/choco · error · ApplicationException
Package name is required. Please pass at least one package n
Error message
Package name is required. Please pass at least one package name to uninstall.
What it means
Thrown by ChocolateyUninstallCommand.Validate when configuration.PackageNames is null or whitespace. The uninstall command requires at least one package name. Package names are populated in ParseAdditionalArguments by joining unparsed arguments that do not start with '-'; if no such arguments are provided, PackageNames remains empty.
Source
Thrown at src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs:168
;
}
public virtual void ParseAdditionalArguments(IList<string> unparsedArguments, ChocolateyConfiguration configuration)
{
configuration.Input = string.Join(" ", unparsedArguments);
configuration.PackageNames = string.Join(ApplicationParameters.PackageNamesSeparator.ToStringSafe(), unparsedArguments.Where(arg => !arg.StartsWith("-")));
if (configuration.RegularOutput)
{
WarnForRemovedOptions(unparsedArguments.Where(arg => arg.StartsWith("-")), _removedOptions);
}
}
public virtual void Validate(ChocolateyConfiguration configuration)
{
if (string.IsNullOrWhiteSpace(configuration.PackageNames))
{
throw new ApplicationException("Package name is required. Please pass at least one package name to uninstall.");
}
}
public override void HelpMessage(ChocolateyConfiguration configuration)
{
this.Log().Info(ChocolateyLoggers.Important, "Uninstall Command");
this.Log().Info(@"
Uninstalls a package or a list of packages.
Chocolatey automatically tracks registry changes for ""Programs and
Features"" of the underlying software's native installers when
installing packages. The ""Automatic Uninstaller"" (auto uninstaller)
service is a feature that can use that information to automatically
determine how to uninstall these natively installed applications. This
means that a package may not need an explicit chocolateyUninstall.ps1
to reverse the installation done in the install script.
Chocolatey tracks packages, which are the files in
View on GitHub (pinned to 0d5abdd10c)
Solutions
- Provide at least one package name: 'choco uninstall <pkg1> [<pkg2> ...]'.
- If uninstalling multiple packages, separate them with commas or spaces: 'choco uninstall pkg1,pkg2'.
- Verify the package is installed first: 'choco list --local-only'.
Example fix
// before choco uninstall // after choco uninstall googlechrome // or multiple choco uninstall googlechrome,firefox
Defensive patterns
Strategy: validation
Validate before calling
// Ensure at least one package name is provided
if (string.IsNullOrWhiteSpace(packageNames))
{
Console.Error.WriteLine("choco uninstall requires at least one package name.");
} Prevention
- Always pass at least one package name to 'choco uninstall'.
- Verify the package is installed first with 'choco list --local-only'.
- In scripts, check that package name variables are non-empty before invoking.
When it happens
Trigger: Running 'choco uninstall' with no package names, or with only flags/options (all starting with '-') and no package names. The check is string.IsNullOrWhiteSpace(configuration.PackageNumbers).
Common situations: User runs bare 'choco uninstall' expecting an interactive prompt. Script has a bug where the package name variable is empty. All arguments start with '-' so none are captured as package names.
Related errors
- When specifying the subcommand '{0}', you must also specify
- A Rule Name (-n|--name) is required when getting information
- When specifying the subcommand '{0}', you must also specify
- When specifying the subcommand '{0}', you must also specify
- No rule with the name {0} could be found.
AI-assisted analysis of chocolatey/choco@0d5abdd10c (2026-08-13).
Data as JSON: /api/errors/aa658081000c902a.
Report an issue: GitHub.