BCUninstaller/Bulk-Crap-Uninstaller · warning · ArgumentException

Unknown argument: {arg}

Error message

Unknown argument: {arg}

What it means

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.

Source

Thrown at source/WinUpdateHelper/Program.cs:90

            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;
                }
            }

            if (_queryType == QueryType.None)
                throw new ArgumentException(@"No commands specified");

            if (_queryType == QueryType.Uninstall && _updateId == null)
                throw new ArgumentException(@"No UpdateID specified");
        }

        private enum QueryType
        {
            None,
            Uninstall,

View on GitHub (pinned to 608321de98)

Solutions

  1. For uninstall, put the command first then the ID: 'uninstall <UpdateID>'.
  2. For list, pass no extra tokens.
  3. Check spelling of command tokens; only u/uninstall and l/list are recognized.
  4. If extending the CLI, add the token as a recognized case rather than letting it hit default.

Example fix

// before
WinUpdateHelper.exe {some-guid}      // no command
WinUpdateHelper.exe list {guid}        // list takes no id
// after
WinUpdateHelper.exe uninstall {some-guid}
Defensive patterns

Strategy: validation

Validate before calling

var known = new[]{"u","uninstall","l","list"};
if (!args.Any(a => known.Contains(a.ToLowerInvariant())))
    throw new ArgumentException("No/unknown command");

Type guard

bool IsKnownCommand(string arg) =>
    new[]{"u","uninstall","l","list"}.Contains(arg.ToLowerInvariant());

Prevention

When it happens

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

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

Related errors


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