{"record":{"id":"5f5e7d85b3fe5671","repo":"Hmbown/CodeWhale","slug":"invalid-boolean-raw","errorCode":null,"errorMessage":"invalid boolean '{raw}'","messagePattern":"invalid boolean '(.+?)'","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/config/src/lib.rs","lineNumber":6450,"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":6432,"sourceCodeEnd":6468,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/config/src/lib.rs#L6432-L6468","documentation":"Thrown by codewhale-config's parse_bool when a string value for a boolean config field (e.g. insecure_skip_tls_verify, telemetry) does not match any accepted token. Accepted values are exactly 1/true/yes/on/enabled and 0/false/no/off/disabled, matched case-insensitively after trimming surrounding whitespace. Anything else aborts parsing instead of guessing a default, so a typo fails loudly at load time.","triggerScenarios":"Any boolean override that goes through string parsing: insecure_skip_tls_verify = \"maybe\", telemetry = \"y\", or a provider-field override with \"enable\". Surrounding spaces and any casing (TRUE, Yes) are fine because the value is trimmed and lowercased, but abbreviations like y/t/f/n and words like enable/disable are not in the accepted set.","commonSituations":"Scripts ported from tools that accept y/n or t/f; CI variables copying shorthand booleans; copy-pasted values that keep a stray quote or append a second token (\"true 1\"); expectation that YAML-style yes/no covers all abbreviations.","solutions":["Change the value to one of the ten accepted tokens: 1, true, yes, on, enabled (truthy) or 0, false, no, off, disabled (falsy) — case and surrounding whitespace do not matter","Replace shorthand abbreviations (y, t, f, n, enable) with full tokens (yes, true, no, false, enabled)","Check the field named in the surrounding error context for stray characters: shell quotes kept inside the value, a duplicated value, or a trailing unit/comment"],"exampleFix":"# before\ninsecure_skip_tls_verify = \"y\"\n\n# after\ninsecure_skip_tls_verify = \"yes\"","handlingStrategy":"validation","validationCode":"fn parses_as_bool(raw: &str) -> bool {\n    matches!(\n        raw.trim().to_ascii_lowercase().as_str(),\n        \"1\" | \"true\" | \"yes\" | \"on\" | \"enabled\"\n        | \"0\" | \"false\" | \"no\" | \"off\" | \"disabled\"\n    )\n}\n\nassert!(parses_as_bool(&raw), \"boolean override must be one of 1/true/yes/on/enabled or 0/false/no/off/disabled\");","typeGuard":"fn is_valid_codewhale_bool(raw: &str) -> bool {\n    matches!(\n        raw.trim().to_ascii_lowercase().as_str(),\n        \"1\" | \"true\" | \"yes\" | \"on\" | \"enabled\"\n        | \"0\" | \"false\" | \"no\" | \"off\" | \"disabled\"\n    )\n}","tryCatchPattern":"match parse_bool(&raw) {\n    Ok(v) => v,\n    Err(err) if err.to_string().starts_with(\"invalid boolean\") => {\n        // surface which field/value, offer the accepted token list\n        return Err(err.context(format!(\"field {field:?}: use 1/true/yes/on/enabled or 0/false/no/off/disabled\")));\n    }\n    Err(err) => return Err(err),\n}","preventionTips":["Normalize boolean inputs at your boundary: accept only bool or the ten documented tokens","In UIs/CLIs, use a real flag or enum instead of free-text boolean strings","Add a unit test listing every accepted token so abbreviation drift is caught early"],"tags":["rust","config","boolean","validation"],"backgroundTag":"invalid-config-value","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}