{"record":{"id":"5f5e7d85b3fe5671","repo":"Hmbown/CodeWhale","slug":"invalid-boolean-raw","errorCode":null,"errorMessage":"invalid boolean '{raw}'","messagePattern":"invalid boolean '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/config/src/lib.rs","lineNumber":6562,"sourceCode":"    }\n    std::fs::copy(&legacy, &primary)\n        .context(\"failed to migrate config from deepseek to codewhale home\")?;\n    tracing::info!(\n        \"Migrated config from {} to {}\",\n        legacy.display(),\n        primary.display()\n    );\n    Ok(Some(ConfigMigration {\n        legacy_path: legacy,\n        primary_path: primary,\n    }))\n}\n\nfn parse_bool(raw: &str) -> Result<bool> {\n    match raw.trim().to_ascii_lowercase().as_str() {\n        \"1\" | \"true\" | \"yes\" | \"on\" | \"enabled\" => Ok(true),\n        \"0\" | \"false\" | \"no\" | \"off\" | \"disabled\" => Ok(false),\n        _ => bail!(\"invalid boolean '{raw}'\"),\n    }\n}\n\nfn parse_http_headers(raw: &str) -> Result<BTreeMap<String, String>> {\n    let mut headers = BTreeMap::new();\n    for pair in raw.trim().split(',') {\n        let pair = pair.trim();\n        if pair.is_empty() {\n            continue;\n        }\n        let Some((name, value)) = pair.split_once('=') else {\n            bail!(\"invalid header pair '{pair}', expected name=value\");\n        };\n        let name = name.trim();\n        let value = value.trim();\n        if name.is_empty() {\n            bail!(\"header name cannot be empty\");\n        }","sourceCodeStart":6544,"sourceCodeEnd":6580,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/config/src/lib.rs#L6544-L6580","documentation":"parse_bool is the config parser's lenient boolean reader, accepting common truthy/falsy words (1/true/yes/on/enabled, 0/false/no/off/disabled, case-insensitive). Any other spelling is rejected so a typo never silently evaluates to false.","triggerScenarios":"A config value (env var or settings string) that parse_bool reads contains an unrecognized word, e.g. \"TRUE \" with an unusual character, \"y\", \"yeah\", \"2\", \"t\", or a localized word like \"ja\"/\"vrai\".","commonSituations":"Setting an env flag to \"Y\"/\"N\" out of habit; typos like \"ture\" or \"flase\"; passing a number other than 0/1; quoting artifacts such as embedded whitespace handled differently than expected (note the parser trims, but inner quotes like \"'true'\" fail).","solutions":["Set the value to one of the accepted words: 1, true, yes, on, enabled or 0, false, no, off, disabled (case-insensitive)","Replace single-letter forms like y/n with yes/no","Check the variable for stray quotes or characters: 'true' with literal quotes is invalid"],"exampleFix":"// before\nCODEWHALE_FLAG='y'\n\n// after\nCODEWHALE_FLAG=yes","handlingStrategy":"validation","validationCode":"const BOOL_WORDS: [&str; 10] = [\"1\",\"true\",\"yes\",\"on\",\"enabled\",\"0\",\"false\",\"no\",\"off\",\"disabled\"];\nfn is_valid_bool(raw: &str) -> bool {\n    BOOL_WORDS.contains(&raw.trim().to_ascii_lowercase().as_str())\n}","typeGuard":"fn as_config_bool(raw: &str) -> Option<bool> {\n    match raw.trim().to_ascii_lowercase().as_str() {\n        \"1\" | \"true\" | \"yes\" | \"on\" | \"enabled\" => Some(true),\n        \"0\" | \"false\" | \"no\" | \"off\" | \"disabled\" => Some(false),\n        _ => None,\n    }\n}","tryCatchPattern":"match result {\n    Err(e) if e.to_string().starts_with(\"invalid boolean\") => {\n        eprintln!(\"use 1/true/yes/on/enabled or 0/false/no/off/disabled\");\n    }\n    other => other?,\n}","preventionTips":["Restrict config booleans to the accepted word list in scripts and docs","Strip shell quotes before the value reaches the parser (\"'true'\" fails)","Avoid y/n and t/f shorthand; they are not accepted"],"tags":["config","parsing","boolean","env-var"],"backgroundTag":"invalid-config-value","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}