{"record":{"id":"51515959c21327de","repo":"gitbutlerapp/gitbutler","slug":"invalid-value-value-use-true-false-or-1-0","errorCode":null,"errorMessage":"Invalid value '{value}'. Use true/false or 1/0.","messagePattern":"Invalid value '(.+?)'\\. Use true/false or 1/0\\.","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/but/src/command/config.rs","lineNumber":2073,"sourceCode":"                writeln!(\n                    out,\n                    \"  {}\",\n                    t.command_suggestion.paint(\"but config ui set tui true\")\n                )?;\n                writeln!(\n                    out,\n                    \"  {}\",\n                    t.command_suggestion.paint(\"but config ui set tui false\")\n                )?;\n            } else if let Some(out) = out.for_json() {\n                out.write_value(serde_json::json!({ \"tui\": tui_enabled }))?;\n            }\n        }\n        Some(UiSubcommand::Set { key, value, global }) => {\n            let git_key = key.to_git_key();\n            let bool_value = gix::config::Boolean::try_from(value.as_bytes().as_bstr())\n                .with_context(|| {\n                    anyhow::anyhow!(\"Invalid value '{value}'. Use true/false or 1/0.\")\n                })?\n                .0;\n            let serialized = if bool_value { \"true\" } else { \"false\" };\n            edit_git_config(&repo, global.into(), |config| {\n                set_config_value(config, git_key, serialized)?;\n                Ok(())\n            })?;\n\n            if let Some(out) = out.for_human() {\n                writeln!(\n                    out,\n                    \"{} Set {} {} {}\",\n                    t.sym().success,\n                    t.config_key.paint(git_key),\n                    t.hint.paint(\"→\"),\n                    if bool_value {\n                        t.config_value.paint(\"true\")\n                    } else {","sourceCodeStart":2055,"sourceCodeEnd":2091,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but/src/command/config.rs#L2055-L2091","documentation":"For `but config ui set <key> <value>`, the value is parsed by gix::config::Boolean::try_from before being written to Git config as 'true'/'false'. The error (attached via with_context to the parse failure) means the string is not a recognized boolean spelling — gix accepts the standard Git set (true/false/1/0/yes/no/on/off, case-insensitive); anything else, including 'enabled', 'y', 'TRUE ' with spaces or 'false,true', fails. The context message itself recommends true/false or 1/0.","triggerScenarios":"`but config ui set tui maybe`, `but config ui set tui yes please`, passing an empty string, or passing a value with surrounding quotes/spaces that reached the parser verbatim.","commonSituations":"Users typing natural-language booleans ('enable', 'off?' as intent), copy-pasting values with stray whitespace or smart quotes, scripts interpolating unvalidated input into the command.","solutions":["Use exactly true or false (or 1/0): `but config ui set tui false`.","Trim whitespace and remove shell quotes so the parser sees a bare word.","If you need arbitrary values, note this subcommand only accepts booleans — write other value types directly with `git config`."],"exampleFix":"# before\n$ but config ui set tui \"false \"   # trailing space\nError: Invalid value 'false '. Use true/false or 1/0.\n\n# after\n$ but config ui set tui false","handlingStrategy":"validation","validationCode":"// Validate before invoking the CLI\nfn parse_bool(value: &str) -> Option<bool> {\n    gix::config::Boolean::try_from(value.as_bytes().as_bstr()).ok().map(|b| b.0)\n}\nif parse_bool(&value).is_none() {\n    return Err(format!(\"Invalid value '{value}'. Use true/false or 1/0.\"));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Restrict UI 'set' inputs to a checkbox or true/false enum in wrappers.","Trim and lowercase user input before passing it in scripts."],"tags":["config","boolean","validation","gix"],"backgroundTag":"invalid-boolean-config-value","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}