Hmbown/CodeWhale · error · anyhow::Error
Failed to update setting: invalid max history '{value}'. Exp
Error message
Failed to update setting: invalid max history '{value}'. Expected a positive number. What it means
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.
Source
Thrown at crates/tui/src/settings.rs:1450
}
"session_auto_resume" | "auto_resume" => {
self.session_auto_resume = parse_bool(value)?;
}
"cost_currency" | "currency" => {
let Some(currency) = crate::pricing::CostCurrency::from_setting(value) else {
anyhow::bail!(
"Failed to update setting: invalid cost currency '{value}'. Expected: usd, cny, rmb, yuan."
);
};
self.cost_currency = match currency {
crate::pricing::CostCurrency::Usd => "usd",
crate::pricing::CostCurrency::Cny => "cny",
}
.to_string();
}
"max_history" | "history" => {
let max: usize = value.parse().map_err(|_| {
anyhow::anyhow!(
"Failed to update setting: invalid max history '{value}'. Expected a positive number."
)
})?;
self.max_input_history = max;
}
"default_model" | "model" => {
let trimmed = value.trim();
if trimmed.is_empty()
|| matches!(
trimmed.to_ascii_lowercase().as_str(),
"none" | "default" | "(default)"
)
{
self.default_model = None;
return Ok(());
}
let Some(model) = normalize_default_model(trimmed) else {View on GitHub (pinned to 0c42157ee5)
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/tui/src/settings.rs:1450 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/4d841430392fdefe.
Report an issue: GitHub.