{"record":{"id":"cc1bc93b03ebb3ed","repo":"Hmbown/CodeWhale","slug":"failed-to-update-setting-invalid-cost-currency","errorCode":null,"errorMessage":"Failed to update setting: invalid cost currency '{value}'. Expected: usd, cny, rmb, yuan.","messagePattern":"Failed to update setting: invalid cost currency '(.+?)'\\. Expected: usd, cny, rmb, yuan\\.","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/settings.rs","lineNumber":1438,"sourceCode":"                    \"plan\" => \"plan\".to_string(),\n                    \"operate\" | \"operation\" | \"ops\" => \"operate\".to_string(),\n                    _ => anyhow::bail!(\n                        \"Failed to update setting: invalid mode '{value}'. Expected: act (agent), plan, or operate.\"\n                    ),\n                };\n            }\n            \"context_panel\" | \"context\" | \"session_panel\" => {\n                self.context_panel = parse_bool(value)?;\n            }\n            \"sessions_rail\" | \"sessions_panel\" | \"session_rail\" => {\n                self.sessions_rail = parse_bool(value)?;\n            }\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\" => {","sourceCodeStart":1420,"sourceCodeEnd":1456,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/settings.rs#L1420-L1456","documentation":"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.","triggerScenarios":"Thrown at crates/tui/src/settings.rs:1438 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the cost currency to usd, cny, rmb, or yuan"],"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"}