{"record":{"id":"3b8f76559436d2a1","repo":"Hmbown/CodeWhale","slug":"failed-to-update-setting-invalid-tool-collapse-mo","errorCode":null,"errorMessage":"Failed to update setting: invalid tool collapse mode '{value}'. Expected: compact, expanded, or calm.","messagePattern":"Failed to update setting: invalid tool collapse mode '(.+?)'\\. Expected: compact, expanded, or calm\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/tui/src/settings.rs","lineNumber":1509,"sourceCode":"        let canonical = Self::canonical_key(key);\n        match key {\n            \"auto_compact\" | \"compact\" => {\n                self.auto_compact = parse_bool(value)?;\n                self.auto_compact_explicit = true;\n            }\n            \"auto_compact_threshold\" | \"auto_compact_threshold_percent\" => {\n                self.auto_compact_threshold_percent =\n                    parse_percent_setting(\"auto_compact_threshold_percent\", value)?;\n                self.auto_compact = true;\n                self.auto_compact_explicit = true;\n            }\n            \"calm_mode\" | \"calm\" => {\n                self.calm_mode = parse_bool(value)?;\n            }\n            \"tool_collapse\" | \"tool_collapse_mode\" | \"collapse\" => {\n                let normalized = normalize_tool_collapse_mode(value);\n                if !matches!(normalized, \"compact\" | \"expanded\" | \"calm\") {\n                    return Err(anyhow::anyhow!(\n                        \"Failed to update setting: invalid tool collapse mode '{value}'. Expected: compact, expanded, or calm.\"\n                    ));\n                }\n                self.tool_collapse_mode = normalized.to_string();\n            }\n            \"low_motion\" | \"motion\" => {\n                self.low_motion = parse_bool(value)?;\n            }\n            \"fancy_animations\" | \"fancy\" | \"animations\" => {\n                self.fancy_animations = parse_bool(value)?;\n            }\n            \"focus_texture\" | \"texture\" => {\n                let normalized = value.trim().to_ascii_lowercase();\n                if !matches!(normalized.as_str(), \"off\" | \"scrim\" | \"grain\") {\n                    anyhow::bail!(\n                        \"Failed to update setting: invalid focus texture '{value}'. Expected: off, scrim, or grain.\"\n                    );\n                }","sourceCodeStart":1491,"sourceCodeEnd":1527,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/settings.rs#L1491-L1527","documentation":"The set()/update-setting handler validates user-provided values before mutating fields. For the tool_collapse setting, the raw string is normalized and must resolve to one of the accepted modes (compact, expanded, calm); anything else is rejected with this error instead of silently storing an unknown mode.","triggerScenarios":"Calling the update-setting entry point with key `tool_collapse`, `tool_collapse_mode`, or `collapse` and a value string that normalizes outside {compact, expanded, calm} — e.g. \"minimal\", \"true\", \"\", \"Collapsed\", or a misspelling like \"colmapsed\".","commonSituations":"User typed an invalid mode in /config; a script or alias passes an old mode name that predates the current set of allowed values; case/spacing mistakes like \" Calm \".","solutions":["Pass one of the exact accepted values: compact, expanded, or calm","Use the /config UI picker for tool_collapse instead of free-text entry to avoid typos","Check normalize_tool_collapse_mode for accepted aliases and update any script that passes legacy names"],"exampleFix":"// before\nsettings.set(\"tool_collapse\", \"minimal\")?; // Err: invalid tool collapse mode\n// after\nsettings.set(\"tool_collapse\", \"calm\")?; // Ok","handlingStrategy":"validation","validationCode":"const MODES: [&str; 3] = [\"compact\", \"expanded\", \"calm\"];\nfn valid_mode(v: &str) -> bool { MODES.contains(&v.trim().to_lowercase().as_str()) }","typeGuard":"fn as_collapse_mode(v: &str) -> Option<&'static str> {\n    match v.trim().to_lowercase().as_str() {\n        \"compact\" => Some(\"compact\"),\n        \"expanded\" => Some(\"expanded\"),\n        \"calm\" => Some(\"calm\"),\n        _ => None,\n    }\n}","tryCatchPattern":"match settings.set(\"tool_collapse\", value) {\n    Ok(_) => {},\n    Err(e) => eprintln!(\"{e}; expected compact, expanded, or calm\"),\n}","preventionTips":["Use the /config picker instead of free text","Check accepted aliases before scripting values","Lowercase and trim input before passing"],"tags":["config","validation","cli-argument"],"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"}