{"record":{"id":"7483734343821ab8","repo":"BCUninstaller/Bulk-Crap-Uninstaller","slug":"error-bad-arguments","errorCode":"ERROR_BAD_ARGUMENTS","errorMessage":"Multiple commands specified","messagePattern":"Multiple commands specified","errorType":"exception","errorClass":"FormatException","httpStatus":null,"severity":"error","filePath":"source/SteamHelper/Program.cs","lineNumber":117,"sourceCode":"                return (int)ResultWin32.ERROR_BAD_ARGUMENTS;\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                LogWriter.WriteExceptionToLog(ex);\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 FormatException(@\"Multiple commands specified\");\r\n                        _queryType = QueryType.Uninstall;\r\n                        break;\r\n\r\n                    case @\"i\":\r\n                    case @\"info\":\r\n                        if (_queryType != QueryType.None) throw new FormatException(@\"Multiple commands specified\");\r\n                        _queryType = QueryType.GetInfo;\r\n                        break;\r\n\r\n                    case @\"/i\":\r\n                    case @\"/info\":\r\n                        if (_queryType != QueryType.List) throw new FormatException(@\"/info must follow the list command\");\r\n                        _infoSwitch = true;\r\n                        break;\r\n\r\n                    case @\"/s\":\r\n                    case @\"/silent\":\r\n                        if (_queryType != QueryType.Uninstall) throw new FormatException(@\"/silent must follow the uninstall command\");\r","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/BCUninstaller/Bulk-Crap-Uninstaller/blob/608321de98e92297377b1eb69029af55c25504a1/source/SteamHelper/Program.cs#L99-L135","documentation":"A FormatException (mapped to ERROR_BAD_ARGUMENTS) from SteamHelper's `ProcessCommandlineArguments` when the `u`/`uninstall` token is encountered but `_queryType` is already set to another command. SteamHelper accepts exactly one top-level command; a second command verb is rejected.","triggerScenarios":"Running SteamHelper with two command verbs, e.g. `SteamHelper uninstall info 123` or `SteamHelper list uninstall`. The guard `if (_queryType != QueryType.None)` fires on the second verb.","commonSituations":"Composing a SteamHelper call from parts where a previous command token was already added; misreading the usage and chaining verbs; stale wrapper scripts that append a default command.","solutions":["Provide exactly one command verb per invocation: `SteamHelper uninstall <id>`.","Strip any previously-set command token before appending a new one in the calling script.","Validate that only one of uninstall/info/list/steam appears in the assembled argument list."],"exampleFix":"// before\nSteamHelper uninstall list 123\n// after\nSteamHelper uninstall 123","handlingStrategy":"validation","validationCode":"// Ensure exactly one top-level command verb in the SteamHelper args.\nvar verbs = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { \"uninstall\",\"u\",\"info\",\"i\",\"list\",\"l\",\"steam\" };\nvar found = args.Where(a => verbs.Contains(a)).ToList();\nif (found.Count > 1) throw new ArgumentException($\"Multiple commands: {string.Join(\",\", found)}\");","typeGuard":null,"tryCatchPattern":"try { /* invoke SteamHelper */ }\ncatch (FormatException ex) when (ex.Message.Contains(\"Multiple commands specified\"))\n{ /* rebuild args with a single command and retry */ }","preventionTips":["Assemble SteamHelper args so only one command verb is ever present.","Unit-test the argument builder for single-command invariant.","Strip stale default commands from wrapper templates."],"tags":["cli","argument-parsing","steamhelper"],"backgroundTag":null,"analyzedSha":"608321de98e92297377b1eb69029af55c25504a1","analyzedAt":"2026-08-13T12:17:35.389Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}