Hmbown/CodeWhale · error · anyhow::Error
Failed to update setting: invalid cost currency '{value}'. E
Error message
Failed to update setting: invalid cost currency '{value}'. Expected: usd, cny, rmb, yuan. What it means
Settings update validation for the cost currency key: the value is not one of usd, cny, rmb, yuan (rmb/yuan are aliases of cny). Rejected at set time so cost formatting never receives an unknown currency code.
Source
Thrown at crates/tui/src/settings.rs:1438
"plan" => "plan".to_string(),
"operate" | "operation" | "ops" => "operate".to_string(),
_ => anyhow::bail!(
"Failed to update setting: invalid mode '{value}'. Expected: act (agent), plan, or operate."
),
};
}
"context_panel" | "context" | "session_panel" => {
self.context_panel = parse_bool(value)?;
}
"sessions_rail" | "sessions_panel" | "session_rail" => {
self.sessions_rail = parse_bool(value)?;
}
"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" => {View on GitHub (pinned to 0c42157ee5)
Solutions
- Set the cost currency to usd, cny, rmb, or yuan
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/tui/src/settings.rs:1438 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/cc1bc93b03ebb3ed.
Report an issue: GitHub.