{"record":{"id":"4d841430392fdefe","repo":"Hmbown/CodeWhale","slug":"failed-to-update-setting-invalid-max-history-va","errorCode":null,"errorMessage":"Failed to update setting: invalid max history '{value}'. Expected a positive number.","messagePattern":"Failed to update setting: invalid max history '(.+?)'\\. Expected a positive number\\.","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/settings.rs","lineNumber":1450,"sourceCode":"            }\n            \"session_auto_resume\" | \"auto_resume\" => {\n                self.session_auto_resume = parse_bool(value)?;\n            }\n            \"cost_currency\" | \"currency\" => {\n                let Some(currency) = crate::pricing::CostCurrency::from_setting(value) else {\n                    anyhow::bail!(\n                        \"Failed to update setting: invalid cost currency '{value}'. Expected: usd, cny, rmb, yuan.\"\n                    );\n                };\n                self.cost_currency = match currency {\n                    crate::pricing::CostCurrency::Usd => \"usd\",\n                    crate::pricing::CostCurrency::Cny => \"cny\",\n                }\n                .to_string();\n            }\n            \"max_history\" | \"history\" => {\n                let max: usize = value.parse().map_err(|_| {\n                    anyhow::anyhow!(\n                        \"Failed to update setting: invalid max history '{value}'. Expected a positive number.\"\n                    )\n                })?;\n                self.max_input_history = max;\n            }\n            \"default_model\" | \"model\" => {\n                let trimmed = value.trim();\n                if trimmed.is_empty()\n                    || matches!(\n                        trimmed.to_ascii_lowercase().as_str(),\n                        \"none\" | \"default\" | \"(default)\"\n                    )\n                {\n                    self.default_model = None;\n                    return Ok(());\n                }\n\n                let Some(model) = normalize_default_model(trimmed) else {","sourceCodeStart":1432,"sourceCodeEnd":1468,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/settings.rs#L1432-L1468","documentation":"Validation failure parsing the max-history setting: the value string did not parse as a positive usize (empty, negative, non-numeric, or overflowing). The message is the generic sentinel for numeric settings whose parse::<usize>() failed in the set path.","triggerScenarios":"Thrown at crates/tui/src/settings.rs:1450 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Supply a plain positive integer such as 10000","Remove units, commas, or quotes from the value","Use 0 only if the setting explicitly allows disabling history"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}