{"record":{"id":"76db65fd4e0f405f","repo":"BCUninstaller/Bulk-Crap-Uninstaller","slug":"multiple-commands-specified-76db65","errorCode":null,"errorMessage":"Multiple commands specified","messagePattern":"Multiple commands specified","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"warning","filePath":"source/WinUpdateHelper/Program.cs","lineNumber":78,"sourceCode":"            }\r\n            catch (Exception ex)\r\n            {\r\n                LogWriter.WriteMessageToLog(ex.ToString());\r\n                Console.WriteLine(\"Error: {0}\", ex.Message);\r\n                return (int)ResultWin32.ERROR_UNEXP_NET_ERR;\r\n            }\r\n            return (int)ResultWin32.ERROR_SUCCESS;\r\n        }\r\n\r\n        private static void ProcessCommandlineArguments(IEnumerable<string> args)\r\n        {\r\n            foreach (var arg in args)\r\n            {\r\n                switch (arg.ToLowerInvariant())\r\n                {\r\n                    case @\"u\":\r\n                    case @\"uninstall\":\r\n                        if (_queryType != QueryType.None) throw new ArgumentException(@\"Multiple commands specified\");\r\n                        _queryType = QueryType.Uninstall;\r\n                        break;\r\n\r\n                    case @\"l\":\r\n                    case @\"list\":\r\n                        if (_queryType != QueryType.None) throw new ArgumentException(@\"Multiple commands specified\");\r\n                        _queryType = QueryType.List;\r\n                        break;\r\n\r\n                    default:\r\n                        if (_queryType != QueryType.Uninstall)\r\n                            throw new ArgumentException($@\"Unknown argument: {arg}\");\r\n                        if (_updateId != null)\r\n                            throw new ArgumentException(@\"Multiple UpdateIDs specified\");\r\n                        _updateId = arg;\r\n                        break;\r\n                }\r\n            }\r","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/BCUninstaller/Bulk-Crap-Uninstaller/blob/608321de98e92297377b1eb69029af55c25504a1/source/WinUpdateHelper/Program.cs#L60-L96","documentation":"ArgumentException thrown in ProcessCommandlineArguments when the 'u'/'uninstall' argument is encountered but _queryType is already set (not QueryType.None). The CLI accepts exactly one command (uninstall or list); a second command token is rejected. This guard fires at the moment the duplicate command token is parsed.","triggerScenarios":"Invoking the helper with two command tokens, e.g. 'WinUpdateHelper uninstall list' or 'WinUpdateHelper u l'. Any command word appearing after the first command word triggers it.","commonSituations":"A caller script concatenates flags incorrectly and passes both 'uninstall' and 'list'. A user mistakes the tool for one that takes multiple subcommands. Argument quoting in a shell wrapper accidentally merges or duplicates tokens.","solutions":["Pass exactly one command token: 'uninstall <UpdateID>' OR 'list'.","If scripting, validate the assembled argument array contains only one command before invoking.","Switch the CLI design to a mutually-exclusive options parser if you control the caller."],"exampleFix":"// before\nWinUpdateHelper.exe uninstall list\n// after\nWinUpdateHelper.exe list","handlingStrategy":"validation","validationCode":"var commands = args.Select(a => a.ToLowerInvariant()).Intersect(new[]{\"u\",\"uninstall\",\"l\",\"list\"}).ToList();\nif (commands.Count > 1) throw new ArgumentException(\"Multiple commands specified\");","typeGuard":"bool HasSingleCommand(IEnumerable<string> args) =>\n    args.Select(a => a.ToLowerInvariant())\n        .Count(a => a == \"u\" || a == \"uninstall\" || a == \"l\" || a == \"list\") == 1;","tryCatchPattern":null,"preventionTips":["Pass exactly one command token per invocation.","Validate the arg array in your wrapper before launching the helper.","Treat u/uninstall and l/list as mutually exclusive."],"tags":["cli","argument-validation","windows-update","wu"],"backgroundTag":null,"analyzedSha":"608321de98e92297377b1eb69029af55c25504a1","analyzedAt":"2026-08-13T12:17:35.389Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}