{"record":{"id":"820d54df359988d4","repo":"BCUninstaller/Bulk-Crap-Uninstaller","slug":"too-many-parameters","errorCode":null,"errorMessage":"Too many parameters","messagePattern":"Too many parameters","errorType":"exception","errorClass":"FormatException","httpStatus":null,"severity":"error","filePath":"source/ScriptHelper/Program.cs","lineNumber":84,"sourceCode":"        {\n            foreach (var arg in args)\n            {\n                switch (arg.ToLowerInvariant())\n                {\n                    case @\"u\":\n                    case @\"uninstall\":\n                        if (_queryType != QueryType.None) throw new FormatException(@\"Multiple commands specified\");\n                        _queryType = QueryType.Uninstall;\n                        break;\n\n                    case @\"l\":\n                    case @\"list\":\n                        if (_queryType != QueryType.None) throw new FormatException(@\"Multiple commands specified\");\n                        _queryType = QueryType.List;\n                        break;\n\n                    default:\n                        if (_appId != null) throw new FormatException(@\"Too many parameters\");\n                        _appId = arg;\n                        break;\n                }\n            }\n\n            if (_queryType == QueryType.None)\n                throw new FormatException(@\"No commands specified\");\n            if (_queryType == QueryType.Uninstall && _appId == null)\n                throw new FormatException(@\"Missing ID parameter for what to uninstall\");\n        }\n\n        private enum QueryType\n        {\n            None,\n            Uninstall,\n            List,\n        }\n    }","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/BCUninstaller/Bulk-Crap-Uninstaller/blob/608321de98e92297377b1eb69029af55c25504a1/source/ScriptHelper/Program.cs#L66-L102","documentation":"A FormatException raised by the ScriptHelper CLI parser when the default switch case receives a second positional (non-command) argument. The parser stores only one appId; a second bare token has nowhere to go, so it is rejected as 'Too many parameters'. ScriptHelper is a thin uninstaller-launcher invoked with exactly one command (uninstall|list) and at most one app identifier.","triggerScenarios":"Invoking ScriptHelper with two or more positional arguments, e.g. `ScriptHelper uninstall 123 456`, or `ScriptHelper 123 456`, or any command followed by two non-command tokens. The first token sets `_appId`; the second hits the `if (_appId != null)` guard.","commonSituations":"Shell quoting mistakes that split a single argument into two tokens; copy-pasting a command line that included trailing stray words; scripting wrappers that concatenate variable arguments without checking count.","solutions":["Pass at most one positional argument after the command: `ScriptHelper uninstall <singleId>`.","Quote any single argument that contains spaces so the shell does not split it into multiple tokens.","Validate the argument count in your caller script before invoking ScriptHelper."],"exampleFix":"// before\nScriptHelper uninstall 123 456\n// after\nScriptHelper uninstall 123","handlingStrategy":"validation","validationCode":"// Before invoking ScriptHelper, ensure at most one positional id and exactly one command.\nvar commands = new[] { \"uninstall\", \"list\", \"l\" };\nvar tokens = args.Where(a => !commands.Contains(a, StringComparer.OrdinalIgnoreCase)).ToList();\nif (tokens.Count > 1) throw new ArgumentException($\"Expected at most one id, got {tokens.Count}\");","typeGuard":null,"tryCatchPattern":"try { /* invoke ScriptHelper */ }\ncatch (FormatException ex) when (ex.Message.Contains(\"Too many parameters\"))\n{ /* log and trim extra positional args, retry with one */ }","preventionTips":["Count positional (non-command) arguments before assembling the command line.","Quote any single argument containing spaces to prevent shell splitting.","Document the one-command-one-id contract in the caller."],"tags":["cli","argument-parsing","scripthelper"],"backgroundTag":null,"analyzedSha":"608321de98e92297377b1eb69029af55c25504a1","analyzedAt":"2026-08-13T12:17:35.389Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}