BCUninstaller/Bulk-Crap-Uninstaller · error · FormatException

ERROR_BAD_ARGUMENTS

ERROR_BAD_ARGUMENTS

Error message

Multiple commands specified

What it means

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.

Source

Thrown at source/SteamHelper/Program.cs:117

                return (int)ResultWin32.ERROR_BAD_ARGUMENTS;
            }
            catch (Exception ex)
            {
                LogWriter.WriteExceptionToLog(ex);
                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 FormatException(@"Multiple commands specified");
                        _queryType = QueryType.Uninstall;
                        break;

                    case @"i":
                    case @"info":
                        if (_queryType != QueryType.None) throw new FormatException(@"Multiple commands specified");
                        _queryType = QueryType.GetInfo;
                        break;

                    case @"/i":
                    case @"/info":
                        if (_queryType != QueryType.List) throw new FormatException(@"/info must follow the list command");
                        _infoSwitch = true;
                        break;

                    case @"/s":
                    case @"/silent":
                        if (_queryType != QueryType.Uninstall) throw new FormatException(@"/silent must follow the uninstall command");

View on GitHub (pinned to 608321de98)

Solutions

  1. Provide exactly one command verb per invocation: `SteamHelper uninstall <id>`.
  2. Strip any previously-set command token before appending a new one in the calling script.
  3. Validate that only one of uninstall/info/list/steam appears in the assembled argument list.

Example fix

// before
SteamHelper uninstall list 123
// after
SteamHelper uninstall 123
Defensive patterns

Strategy: validation

Validate before calling

// Ensure exactly one top-level command verb in the SteamHelper args.
var verbs = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "uninstall","u","info","i","list","l","steam" };
var found = args.Where(a => verbs.Contains(a)).ToList();
if (found.Count > 1) throw new ArgumentException($"Multiple commands: {string.Join(",", found)}");

Try / catch

try { /* invoke SteamHelper */ }
catch (FormatException ex) when (ex.Message.Contains("Multiple commands specified"))
{ /* rebuild args with a single command and retry */ }

Prevention

When it happens

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

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

Related errors


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