{"record":{"id":"d2283a7f00b9aab2","repo":"Devolutions/UniGetUI","slug":"the-value-supplied-to-argumentname-must-be-eithe","errorCode":null,"errorMessage":"The value supplied to {argumentName} must be either true or false.","messagePattern":"The value supplied to (.+?) must be either true or false\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/UniGetUI.Interface.IpcApi/IpcCliCommandRunner.cs","lineNumber":815,"sourceCode":"    }\n\n    private static bool? GetOptionalBoolArgument(\n        IReadOnlyList<string> arguments,\n        string argumentName\n    )\n    {\n        string? value = GetOptionalArgument(arguments, argumentName);\n        if (value is null)\n        {\n            return null;\n        }\n\n        if (bool.TryParse(value, out bool result))\n        {\n            return result;\n        }\n\n        throw new InvalidOperationException(\n            $\"The value supplied to {argumentName} must be either true or false.\"\n        );\n    }\n\n    private static bool GetRequiredBoolArgument(IReadOnlyList<string> arguments, string argumentName)\n    {\n        bool? value = GetOptionalBoolArgument(arguments, argumentName);\n        if (!value.HasValue)\n        {\n            throw new InvalidOperationException(\n                $\"This command requires {argumentName} with a value of true or false.\"\n            );\n        }\n\n        return value.Value;\n    }\n\n    private static async Task<int> WriteJsonAsync<T>(TextWriter output, T value)","sourceCodeStart":797,"sourceCodeEnd":833,"githubUrl":"https://github.com/Devolutions/UniGetUI/blob/9b1d7d0eab91620fc15c86b36676532095936ae3/src/UniGetUI.Interface.IpcApi/IpcCliCommandRunner.cs#L797-L833","documentation":"Thrown by GetOptionalBoolArgument when an optional boolean flag is present but its value is not accepted by bool.TryParse (True/False case-insensitive only; not 1/0/yes/no). This helper backs flags like --include-installed, --elevated, --interactive, --skip-hash on bundle install.","triggerScenarios":"Passing '--elevated yes', '--skip-hash 1', '--interactive on', or '--include-installed y' to a bundle install command. The flag is detected by GetOptionalArgument, then bool.TryParse fails.","commonSituations":"Using 1/0 or yes/no, which many other CLIs accept. Copying values from environment-variable-style configs. Abbreviations like 'y'/'n'.","solutions":["Pass 'true' or 'false' (case-insensitive), e.g. '--elevated true'.","Remember 1/0/yes/no/on are rejected by .NET's bool.TryParse.","If you only want the default-on behavior, omit the flag rather than passing a truthy token."],"exampleFix":"// before\nunigetui bundle install --elevated yes\n// after\nunigetui bundle install --elevated true","handlingStrategy":"validation","validationCode":"static bool TryNormalizeBool(string? raw, out bool value) =>\n    bool.TryParse(raw, out value);\n\n// translate common aliases before calling the CLI:\nstatic string? CanonicalizeBool(string? raw) => raw?.Trim().ToLowerInvariant() switch\n{\n    \"1\" or \"yes\" or \"on\" or \"y\" => \"true\",\n    \"0\" or \"no\" or \"off\" or \"n\" => \"false\",\n    var v => v,\n};","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Canonicalize user booleans (1/0/yes/no) to true/false before forwarding to the CLI.","Prefer flag presence/absence over values where the CLI supports it."],"tags":["ipc","cli","bundle","input-validation","boolean"],"backgroundTag":null,"analyzedSha":"9b1d7d0eab91620fc15c86b36676532095936ae3","analyzedAt":"2026-08-13T12:19:18.278Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}