{"record":{"id":"aa658081000c902a","repo":"chocolatey/choco","slug":"package-name-is-required-please-pass-at-least-one-aa6580","errorCode":null,"errorMessage":"Package name is required. Please pass at least one package name to uninstall.","messagePattern":"Package name is required\\. Please pass at least one package name to uninstall\\.","errorType":"validation","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs","lineNumber":168,"sourceCode":"                ;\r\n        }\r\n\r\n        public virtual void ParseAdditionalArguments(IList<string> unparsedArguments, ChocolateyConfiguration configuration)\r\n        {\r\n            configuration.Input = string.Join(\" \", unparsedArguments);\r\n            configuration.PackageNames = string.Join(ApplicationParameters.PackageNamesSeparator.ToStringSafe(), unparsedArguments.Where(arg => !arg.StartsWith(\"-\")));\r\n\r\n            if (configuration.RegularOutput)\r\n            {\r\n                WarnForRemovedOptions(unparsedArguments.Where(arg => arg.StartsWith(\"-\")), _removedOptions);\r\n            }\r\n        }\r\n\r\n        public virtual void Validate(ChocolateyConfiguration configuration)\r\n        {\r\n            if (string.IsNullOrWhiteSpace(configuration.PackageNames))\r\n            {\r\n                throw new ApplicationException(\"Package name is required. Please pass at least one package name to uninstall.\");\r\n            }\r\n        }\r\n\r\n        public override void HelpMessage(ChocolateyConfiguration configuration)\r\n        {\r\n            this.Log().Info(ChocolateyLoggers.Important, \"Uninstall Command\");\r\n            this.Log().Info(@\"\r\nUninstalls a package or a list of packages.\r\n\r\nChocolatey automatically tracks registry changes for \"\"Programs and\r\n Features\"\" of the underlying software's native installers when\r\n installing packages. The \"\"Automatic Uninstaller\"\" (auto uninstaller)\r\n service is a feature that can use that information to automatically\r\n determine how to uninstall these natively installed applications. This\r\n means that a package may not need an explicit chocolateyUninstall.ps1\r\n to reverse the installation done in the install script.\r\n\r\nChocolatey tracks packages, which are the files in\r","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/chocolatey/choco/blob/0d5abdd10cc177a141e69547cad6935b419b6c17/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs#L150-L186","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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'."],"exampleFix":"// before\nchoco uninstall\n// after\nchoco uninstall googlechrome\n// or multiple\nchoco uninstall googlechrome,firefox","handlingStrategy":"validation","validationCode":"// Ensure at least one package name is provided\nif (string.IsNullOrWhiteSpace(packageNames))\n{\n    Console.Error.WriteLine(\"choco uninstall requires at least one package name.\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["chocolatey","uninstall-command","missing-argument","validation"],"backgroundTag":null,"analyzedSha":"0d5abdd10cc177a141e69547cad6935b419b6c17","analyzedAt":"2026-08-13T18:33:03.301Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}