{"record":{"id":"0818f8497443452e","repo":"BCUninstaller/Bulk-Crap-Uninstaller","slug":"unknown-argument-arg","errorCode":null,"errorMessage":"Unknown argument: {arg}","messagePattern":"Unknown argument: (.+?)","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"warning","filePath":"source/WinUpdateHelper/Program.cs","lineNumber":90,"sourceCode":"            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\n\r\n            if (_queryType == QueryType.None)\r\n                throw new ArgumentException(@\"No commands specified\");\r\n\r\n            if (_queryType == QueryType.Uninstall && _updateId == null)\r\n                throw new ArgumentException(@\"No UpdateID specified\");\r\n        }\r\n\r\n        private enum QueryType\r\n        {\r\n            None,\r\n            Uninstall,\r","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/BCUninstaller/Bulk-Crap-Uninstaller/blob/608321de98e92297377b1eb69029af55c25504a1/source/WinUpdateHelper/Program.cs#L72-L108","documentation":"ArgumentException thrown in the default case of the argument switch when an unrecognized token is encountered AND _queryType is not Uninstall. The default case is the only place an UpdateID is accepted, and only as a trailing argument to 'uninstall'. Any token that is not a command word and appears without a preceding 'uninstall' (or appears after 'list') is rejected as unknown.","triggerScenarios":"Passing an UpdateID before any command: 'WinUpdateHelper <some-guid>'. Passing an UpdateID after 'list': 'WinUpdateHelper list <guid>' (list takes no ID). Passing a typo'd or unsupported flag like 'remove' or '--help'.","commonSituations":"User assumes positional UpdateID works without a command. A caller puts the ID in the wrong slot. Misspelled command ('unistall'). Unrecognized help/version flags the tool never implements.","solutions":["For uninstall, put the command first then the ID: 'uninstall <UpdateID>'.","For list, pass no extra tokens.","Check spelling of command tokens; only u/uninstall and l/list are recognized.","If extending the CLI, add the token as a recognized case rather than letting it hit default."],"exampleFix":"// before\nWinUpdateHelper.exe {some-guid}      // no command\nWinUpdateHelper.exe list {guid}        // list takes no id\n// after\nWinUpdateHelper.exe uninstall {some-guid}","handlingStrategy":"validation","validationCode":"var known = new[]{\"u\",\"uninstall\",\"l\",\"list\"};\nif (!args.Any(a => known.Contains(a.ToLowerInvariant())))\n    throw new ArgumentException(\"No/unknown command\");","typeGuard":"bool IsKnownCommand(string arg) =>\n    new[]{\"u\",\"uninstall\",\"l\",\"list\"}.Contains(arg.ToLowerInvariant());","tryCatchPattern":null,"preventionTips":["Always precede an UpdateID with the 'uninstall' command.","Do not pass an ID after 'list'.","Check command spelling; only u/uninstall/l/list are valid."],"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"}