Devolutions/UniGetUI · error · InvalidOperationException
The value supplied to --enabled must be either true or false
Error message
The value supplied to --enabled must be either true or false.
What it means
Thrown by IpcCliCommandRunner.BuildSettingRequest when the '--enabled' flag value cannot be parsed by bool.TryParse. This is specific to the set-setting CLI path, which accepts only .NET bool tokens (True/False case-insensitive, and '1'/'0' are NOT accepted by bool.TryParse).
Source
Thrown at src/UniGetUI.Interface.IpcApi/IpcCliCommandRunner.cs:729
{
return new IpcBundleInstallRequest
{
IncludeInstalled = GetOptionalBoolArgument(args, "--include-installed"),
Elevated = GetOptionalBoolArgument(args, "--elevated"),
Interactive = GetOptionalBoolArgument(args, "--interactive"),
SkipHash = GetOptionalBoolArgument(args, "--skip-hash"),
};
}
private static IpcSettingValueRequest BuildSettingRequest(IReadOnlyList<string> args)
{
bool? enabled = null;
string? enabledValue = GetOptionalArgument(args, "--enabled");
if (enabledValue is not null)
{
if (!bool.TryParse(enabledValue, out bool parsedEnabled))
{
throw new InvalidOperationException(
"The value supplied to --enabled must be either true or false."
);
}
enabled = parsedEnabled;
}
return new IpcSettingValueRequest
{
SettingKey = GetRequiredArgument(
args,
"--key",
"This command requires --key."
),
Enabled = enabled,
Value = GetOptionalArgument(args, "--value"),
};
}View on GitHub (pinned to 9b1d7d0eab)
Solutions
- Pass '--enabled true' or '--enabled false' (case-insensitive).
- Note that '1'/'0'/'yes'/'on' are rejected; spell the word out.
- Omit --enabled entirely if you only want to set a string --value.
Example fix
// before unigetui set-setting --key AutoCheckUpdates --enabled 1 // after unigetui set-setting --key AutoCheckUpdates --enabled true
Defensive patterns
Strategy: validation
Validate before calling
static bool TryNormalizeEnabled(string? raw, out bool value) =>
bool.TryParse(raw, out value);
// reject '1/0/yes/no' explicitly in the UI before calling set-setting. Prevention
- Use a boolean toggle in the UI, not free text, for --enabled.
- Document that only 'true'/'false' are accepted (no 1/0/yes/no).
When it happens
Trigger: Running 'unigetui set-setting --key X --enabled yes', '--enabled 1', '--enabled on', or '--enabled enable'. bool.TryParse only accepts 'True'/'False' (any case) and null.
Common situations: Shell users passing 1/0 or yes/no, common in other CLIs. Copying a value from a YAML/config that uses 'on'. Locale-influenced booleans.
Related errors
- The value supplied to {argumentName} must be either true or
- This command requires {argumentName} with a value of true or
- The value supplied to {argumentName} must be an integer.
- Bundle export only supports .ubundle and .json output files.
- The bundle format "{format}" is not supported.
AI-assisted analysis of Devolutions/UniGetUI@9b1d7d0eab (2026-08-13).
Data as JSON: /api/errors/a65d39851d025948.
Report an issue: GitHub.