BCUninstaller/Bulk-Crap-Uninstaller · warning · ArgumentException

Multiple commands specified

Error message

Multiple commands specified

What it means

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.

Source

Thrown at source/WinUpdateHelper/Program.cs:78

            }
            catch (Exception ex)
            {
                LogWriter.WriteMessageToLog(ex.ToString());
                Console.WriteLine("Error: {0}", ex.Message);
                return (int)ResultWin32.ERROR_UNEXP_NET_ERR;
            }
            return (int)ResultWin32.ERROR_SUCCESS;
        }

        private static void ProcessCommandlineArguments(IEnumerable<string> args)
        {
            foreach (var arg in args)
            {
                switch (arg.ToLowerInvariant())
                {
                    case @"u":
                    case @"uninstall":
                        if (_queryType != QueryType.None) throw new ArgumentException(@"Multiple commands specified");
                        _queryType = QueryType.Uninstall;
                        break;

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

                    default:
                        if (_queryType != QueryType.Uninstall)
                            throw new ArgumentException($@"Unknown argument: {arg}");
                        if (_updateId != null)
                            throw new ArgumentException(@"Multiple UpdateIDs specified");
                        _updateId = arg;
                        break;
                }
            }

View on GitHub (pinned to 608321de98)

Solutions

  1. Pass exactly one command token: 'uninstall <UpdateID>' OR 'list'.
  2. If scripting, validate the assembled argument array contains only one command before invoking.
  3. Switch the CLI design to a mutually-exclusive options parser if you control the caller.

Example fix

// before
WinUpdateHelper.exe uninstall list
// after
WinUpdateHelper.exe list
Defensive patterns

Strategy: validation

Validate before calling

var commands = args.Select(a => a.ToLowerInvariant()).Intersect(new[]{"u","uninstall","l","list"}).ToList();
if (commands.Count > 1) throw new ArgumentException("Multiple commands specified");

Type guard

bool HasSingleCommand(IEnumerable<string> args) =>
    args.Select(a => a.ToLowerInvariant())
        .Count(a => a == "u" || a == "uninstall" || a == "l" || a == "list") == 1;

Prevention

When it happens

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

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

Related errors


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