Devolutions/UniGetUI · error · InvalidOperationException

The value supplied to {argumentName} must be an integer.

Error message

The value supplied to {argumentName} must be an integer.

What it means

Thrown by GetOptionalIntArgument when an argument that is present on the command line cannot be parsed as an Int32 by int.TryParse (culture-invariant, integer only). This helper backs any CLI integer flag (e.g. timeouts, line counts) so the offending argument name is interpolated into the message.

Source

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

    }

    private static int? GetOptionalIntArgument(
        IReadOnlyList<string> arguments,
        string argumentName
    )
    {
        string? value = GetOptionalArgument(arguments, argumentName);
        if (value is null)
        {
            return null;
        }

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

        throw new InvalidOperationException(
            $"The value supplied to {argumentName} must be an integer."
        );
    }

    private static bool? GetOptionalBoolArgument(
        IReadOnlyList<string> arguments,
        string argumentName
    )
    {
        string? value = GetOptionalArgument(arguments, argumentName);
        if (value is null)
        {
            return null;
        }

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

View on GitHub (pinned to 9b1d7d0eab)

Solutions

  1. Supply a plain integer within Int32 range, e.g. '--tail-lines 100'.
  2. Remove any unit suffixes or thousands separators.
  3. Check the command's help to confirm the flag expects an integer.

Example fix

// before
unigetui operation output --id abc123 --tail-lines 1.5k
// after
unigetui operation output --id abc123 --tail-lines 1500
Defensive patterns

Strategy: validation

Validate before calling

static bool TryNormalizeInt(string? raw, out int value) =>
    int.TryParse(raw, NumberStyles.Integer, CultureInfo.InvariantCulture, out value);

Prevention

When it happens

Trigger: Passing a non-numeric or out-of-int-range value to an integer CLI flag, e.g. '--tail-lines abc', '--tail-lines 99999999999' (overflow), or '--tail-lines 1.5'. The argument is found by GetOptionalArgument and then int.TryParse fails.

Common situations: Passing a float where an int is expected. Exceeding Int32.MaxValue for a count. A unit suffix like '--tail-lines 100k'. Locale decimal separators.

Related errors


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