{"record":{"id":"d30734fb31b312f7","repo":"chocolatey/choco","slug":"a-single-sources-command-must-be-listed-please-se","errorCode":null,"errorMessage":"A single sources command must be listed. Please see the help menu for those commands","messagePattern":"A single sources command must be listed\\. Please see the help menu for those commands","errorType":"validation","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs","lineNumber":87,"sourceCode":"                 .Add(\"bypassproxy|bypass-proxy\",\r\n                     \"Bypass Proxy - Should this source explicitly bypass any explicitly or system configured proxies? Defaults to false.\",\r\n                     option => configuration.SourceCommand.BypassProxy = option != null)\r\n                 .Add(\"allowselfservice|allow-self-service\",\r\n                     \"Allow Self-Service - Should this source be allowed to be used with self-service? Requires business edition with feature 'useBackgroundServiceWithSelfServiceSourcesOnly' turned on. Defaults to false.\",\r\n                     option => configuration.SourceCommand.AllowSelfService = option != null)\r\n                 .Add(\"adminonly|admin-only\",\r\n                     \"Visible to Administrators Only - Should this source be visible to non-administrators? Requires business edition. Defaults to false.\",\r\n                     option => configuration.SourceCommand.VisibleToAdminsOnly = option != null)\r\n                ;\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\r\n            if (unparsedArguments.Count > 1)\r\n            {\r\n                throw new ApplicationException(\"A single sources command must be listed. Please see the help menu for those commands\");\r\n            }\r\n\r\n            var command = SourceCommandType.Unknown;\r\n            var unparsedCommand = unparsedArguments.DefaultIfEmpty(string.Empty).FirstOrDefault();\r\n            Enum.TryParse(unparsedCommand, true, out command);\r\n            if (command == SourceCommandType.Unknown)\r\n            {\r\n                if (!string.IsNullOrWhiteSpace(unparsedCommand))\r\n                {\r\n                    this.Log().Warn(\"Unknown command {0}. Setting to list.\".FormatWith(unparsedCommand));\r\n                }\r\n\r\n                command = SourceCommandType.List;\r\n            }\r\n\r\n            configuration.SourceCommand.Command = command;\r\n        }\r\n\r","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/chocolatey/choco/blob/0d5abdd10cc177a141e69547cad6935b419b6c17/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs#L69-L105","documentation":"Thrown by ChocolateySourceCommand.ParseAdditionalArguments when more than one unparsed positional argument is supplied to 'choco source'. The source command accepts exactly one subcommand verb (list, add, remove, disable, enable); two or more positional tokens are ambiguous and rejected.","triggerScenarios":"Running 'choco source add list', 'choco source add remove', or any invocation with 2+ positional arguments. The check is unparsedArguments.Count > 1.","commonSituations":"User chains multiple source operations in one command. A script concatenates arguments incorrectly. User misunderstands syntax, thinking subcommands can be combined.","solutions":["Pass only a single source subcommand per invocation: 'choco source add', 'choco source list', etc.","For multiple source operations, issue separate 'choco source' calls.","Run 'choco source --help' to review accepted subcommands."],"exampleFix":"// before\nchoco source add list --name=myfeed\n// after\nchoco source add --name=myfeed --source=\"https://feed/\"\nchoco source list","handlingStrategy":"validation","validationCode":"// Ensure only one positional subcommand\nif (positionalArgs.Count(arg => !arg.StartsWith(\"-\")) > 1)\n{\n    Console.Error.WriteLine(\"Pass a single source subcommand (list, add, remove, disable, enable).\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Issue each source operation as a separate 'choco source <subcommand>' call.","Validate positional argument count before invoking."],"tags":["chocolatey","source-command","argument-validation","cli-usage"],"backgroundTag":null,"analyzedSha":"0d5abdd10cc177a141e69547cad6935b419b6c17","analyzedAt":"2026-08-13T18:33:03.301Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}