Devolutions/UniGetUI · error · InvalidOperationException

This command requires {argumentName} with a value of true or

Error message

This command requires {argumentName} with a value of true or false.

What it means

Thrown by GetRequiredBoolArgument when GetOptionalBoolArgument returns null, meaning the flag is entirely absent from the arguments list (or present without a following token). Distinct from error 26: that fires when the value is present but malformed; this fires when it is missing.

Source

Thrown at src/UniGetUI.Interface.IpcApi/IpcCliCommandRunner.cs:825

            return null;
        }

        if (bool.TryParse(value, out bool result))
        {
            return result;
        }

        throw new InvalidOperationException(
            $"The value supplied to {argumentName} must be either true or false."
        );
    }

    private static bool GetRequiredBoolArgument(IReadOnlyList<string> arguments, string argumentName)
    {
        bool? value = GetOptionalBoolArgument(arguments, argumentName);
        if (!value.HasValue)
        {
            throw new InvalidOperationException(
                $"This command requires {argumentName} with a value of true or false."
            );
        }

        return value.Value;
    }

    private static async Task<int> WriteJsonAsync<T>(TextWriter output, T value)
    {
        await output.WriteLineAsync(
            IpcJson.Serialize(value)
        );
        return (int)IpcCliExitCode.Success;
    }

    private static async Task<int> WriteWrappedJsonAsync<T>(
        TextWriter output,
        string propertyName,

View on GitHub (pinned to 9b1d7d0eab)

Solutions

  1. Provide the flag with an explicit true/false value as the next token.
  2. Ensure the value token is not consumed by an earlier flag or stripped by shell quoting.
  3. Check the command definition to confirm which flags are required booleans.

Example fix

// before
unigetui <cmd> --required-bool
// after
unigetui <cmd> --required-bool true
Defensive patterns

Strategy: validation

Validate before calling

static bool HasRequiredBool(IReadOnlyList<string> args, string name)
{
    int i = args.IndexOf(name);
    return i >= 0 && i + 1 < args.Count && bool.TryParse(args[i + 1], out _);
}

Prevention

When it happens

Trigger: Calling a command that mandates a boolean flag but omitting it, e.g. a hypothetical '--force' required-bool with no value, or providing the flag name as the last token with no value after it (GetOptionalArgument returns null when index+1 >= args.Count).

Common situations: Forgetting the value token entirely ('--flag' with nothing after). Quoting that swallows the next token. Assuming the flag is optional when the command requires it.

Related errors


AI-assisted analysis of Devolutions/UniGetUI@9b1d7d0eab (2026-08-13). Data as JSON: /api/errors/1674bc0a1d104eb8. Report an issue: GitHub.