{"record":{"id":"858e1ac478aa88c0","repo":"chocolatey/choco","slug":"package-name-is-required-please-pass-at-least-one","errorCode":null,"errorMessage":"Package name is required. Please pass at least one package name to install.","messagePattern":"Package name is required\\. Please pass at least one package name to install\\.","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs","lineNumber":232,"sourceCode":"            //todo: #770 package name can be a url / installertype\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 install.\");\r\n            }\r\n            // Need a better check on this before releasing. Issue will be covered by other fixes\r\n            //// investigate https://msdn.microsoft.com/en-us/library/system.io.path.getinvalidpathchars(v=vs.100).aspx\r\n            //if (configuration.PackageNames.Contains(\":\"))\r\n            //{\r\n            //    throw new ApplicationException(\"Package name cannot contain invalid characters.\");\r\n            //}\r\n\r\n            if (configuration.ForceDependencies && !configuration.Force)\r\n            {\r\n                throw new ApplicationException(\"Force dependencies can only be used with force also turned on.\");\r\n            }\r\n\r\n            if (!string.IsNullOrWhiteSpace(configuration.Input))\r\n            {\r\n                var unparsedOptionsAndPackages = configuration.Input.Split(new[] { \" \" }, StringSplitOptions.RemoveEmptyEntries);\r\n                if (!configuration.Information.IsLicensedVersion)\r\n                {\r","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/chocolatey/choco/blob/0d5abdd10cc177a141e69547cad6935b419b6c17/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs#L214-L250","documentation":"The install command requires at least one package name. ParseAdditionalArguments builds configuration.PackageNames from non-flag positional tokens; Validate() throws if that value is blank, meaning no package was specified.","triggerScenarios":"Running 'choco install' with no package name (only flags/switches), or all positional tokens starting with '-' so they are filtered out.","commonSituations":"Bare 'choco install'; scripts where the package variable is empty; arguments that were all parsed as options.","solutions":["Pass at least one package name: 'choco install <pkg>'.","In automation, assert the package variable is non-empty before invoking choco.","Ensure names don't accidentally start with '-' so they aren't treated as options."],"exampleFix":"# before\nchoco install --yes\n\n# after\nchoco install chocolatey --yes","handlingStrategy":"validation","validationCode":"// Ensure at least one non-flag package name.\nvar packages = tokens.Where(t => !t.StartsWith(\"-\")).ToList();\nif (packages.Count == 0)\n{\n    throw new InvalidOperationException(\"install requires at least one package name\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate the package variable in automation before invoking choco install.","Make sure package names don't begin with '-' so they aren't filtered as options."],"tags":["install","validation","package-name"],"backgroundTag":null,"analyzedSha":"0d5abdd10cc177a141e69547cad6935b419b6c17","analyzedAt":"2026-08-13T18:33:03.301Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}