{"record":{"id":"1674bc0a1d104eb8","repo":"Devolutions/UniGetUI","slug":"this-command-requires-argumentname-with-a-value","errorCode":null,"errorMessage":"This command requires {argumentName} with a value of true or false.","messagePattern":"This command requires (.+?) with a value of true or false\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/UniGetUI.Interface.IpcApi/IpcCliCommandRunner.cs","lineNumber":825,"sourceCode":"            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)\n    {\n        await output.WriteLineAsync(\n            IpcJson.Serialize(value)\n        );\n        return (int)IpcCliExitCode.Success;\n    }\n\n    private static async Task<int> WriteWrappedJsonAsync<T>(\n        TextWriter output,\n        string propertyName,","sourceCodeStart":807,"sourceCodeEnd":843,"githubUrl":"https://github.com/Devolutions/UniGetUI/blob/9b1d7d0eab91620fc15c86b36676532095936ae3/src/UniGetUI.Interface.IpcApi/IpcCliCommandRunner.cs#L807-L843","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Provide the flag with an explicit true/false value as the next token.","Ensure the value token is not consumed by an earlier flag or stripped by shell quoting.","Check the command definition to confirm which flags are required booleans."],"exampleFix":"// before\nunigetui <cmd> --required-bool\n// after\nunigetui <cmd> --required-bool true","handlingStrategy":"validation","validationCode":"static bool HasRequiredBool(IReadOnlyList<string> args, string name)\n{\n    int i = args.IndexOf(name);\n    return i >= 0 && i + 1 < args.Count && bool.TryParse(args[i + 1], out _);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pre-flight check that every required boolean flag has a following value token.","Build argument lists with a small builder that pairs flags with values to avoid orphan tokens."],"tags":["ipc","cli","input-validation","boolean","missing-argument"],"backgroundTag":null,"analyzedSha":"9b1d7d0eab91620fc15c86b36676532095936ae3","analyzedAt":"2026-08-13T12:19:18.278Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}