BCUninstaller/Bulk-Crap-Uninstaller · error · FormatException

Too many parameters

Error message

Too many parameters

What it means

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.

Source

Thrown at source/ScriptHelper/Program.cs:84

        {
            foreach (var arg in args)
            {
                switch (arg.ToLowerInvariant())
                {
                    case @"u":
                    case @"uninstall":
                        if (_queryType != QueryType.None) throw new FormatException(@"Multiple commands specified");
                        _queryType = QueryType.Uninstall;
                        break;

                    case @"l":
                    case @"list":
                        if (_queryType != QueryType.None) throw new FormatException(@"Multiple commands specified");
                        _queryType = QueryType.List;
                        break;

                    default:
                        if (_appId != null) throw new FormatException(@"Too many parameters");
                        _appId = arg;
                        break;
                }
            }

            if (_queryType == QueryType.None)
                throw new FormatException(@"No commands specified");
            if (_queryType == QueryType.Uninstall && _appId == null)
                throw new FormatException(@"Missing ID parameter for what to uninstall");
        }

        private enum QueryType
        {
            None,
            Uninstall,
            List,
        }
    }

View on GitHub (pinned to 608321de98)

Solutions

  1. Pass at most one positional argument after the command: `ScriptHelper uninstall <singleId>`.
  2. Quote any single argument that contains spaces so the shell does not split it into multiple tokens.
  3. Validate the argument count in your caller script before invoking ScriptHelper.

Example fix

// before
ScriptHelper uninstall 123 456
// after
ScriptHelper uninstall 123
Defensive patterns

Strategy: validation

Validate before calling

// Before invoking ScriptHelper, ensure at most one positional id and exactly one command.
var commands = new[] { "uninstall", "list", "l" };
var tokens = args.Where(a => !commands.Contains(a, StringComparer.OrdinalIgnoreCase)).ToList();
if (tokens.Count > 1) throw new ArgumentException($"Expected at most one id, got {tokens.Count}");

Try / catch

try { /* invoke ScriptHelper */ }
catch (FormatException ex) when (ex.Message.Contains("Too many parameters"))
{ /* log and trim extra positional args, retry with one */ }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of BCUninstaller/Bulk-Crap-Uninstaller@608321de98 (2026-08-13). Data as JSON: /api/errors/820d54df359988d4. Report an issue: GitHub.