{"record":{"id":"c483549f1badbd91","repo":"Hmbown/CodeWhale","slug":"can-t-use-value-for-key-try-choices","errorCode":null,"errorMessage":"Can't use '{value}' for {key}. Try: {choices}.","messagePattern":"Can't use '(.+?)' for (.+?)\\. Try: (.+?)\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/tui/src/tui/ui/apply.rs","lineNumber":1272,"sourceCode":"        // toggling the stale flag off.\n        app.voice_enabled = false;\n    }\n    let notice = app\n        .tr(MessageId::SettingLockedDuringTurn)\n        .replace(\"{setting}\", \"Codewhale Runtime\");\n    app.push_status_toast(notice, crate::tui::app::StatusToastLevel::Info, Some(6_000));\n    true\n}\n\npub(crate) fn apply_notification_update(\n    app: &mut App,\n    config: &mut Config,\n    update: crate::config::NotificationConfigUpdate,\n) -> Result<()> {\n    let mut notifications = config.notifications_config();\n    let setting = update.setting();\n    notifications.apply_update(update).map_err(|_| {\n        anyhow::anyhow!(\n            app.tr(MessageId::ConfigCommandInvalidValue)\n                .replace(\"{key}\", &format!(\"notifications.{}\", setting.key()))\n                .replace(\"{value}\", &app.tr(MessageId::ConfigUnavailable))\n                .replace(\"{choices}\", setting.choices())\n        )\n    })?;\n    config.notifications = Some(notifications);\n    app.refresh_notification_settings(config);\n    Ok(())\n}\n\npub(crate) async fn apply_command_result(\n    terminal: &mut AppTerminal,\n    app: &mut App,\n    engine_handle: &mut EngineHandle,\n    task_manager: &SharedTaskManager,\n    config: &mut Config,\n    result: commands::CommandResult,","sourceCodeStart":1254,"sourceCodeEnd":1290,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tui/ui/apply.rs#L1254-L1290","documentation":"apply_notification_update pushes a NotificationConfigUpdate into the notifications config; when notifications.apply_update rejects the value, the error is mapped to a localized message telling the user the given value can't be used for the given notifications.<setting> key, listing the valid choices.","triggerScenarios":"Calling apply_command_result (or a live config delta) that resolves to a NotificationConfigUpdate whose value is not one of the setting's allowed choices — e.g. an invalid boolean/enum-style notifications setting typed in a /config command or an invalid value arriving via a live config notification.","commonSituations":"Typing /config notifications.<setting> <bad value>; a plugin or automation pushing an unsupported notifications value; locale string placeholders ({key}/{value}/{choices}) mismatching user expectation.","solutions":["Use one of the listed valid choices for notifications.<setting> (the message includes them via setting.choices())","Check the NotificationConfigUpdate construction site for a wrong/renamed value","Update Codewhale if the setting's accepted values changed in a newer version"],"exampleFix":"// before\napply_command_result(app, \"/config notifications.sound maybe\")?;\n// after\napply_command_result(app, \"/config notifications.sound on\")?; // use a listed choice","handlingStrategy":"validation","validationCode":"// Validate against the setting's choices before applying\nfn value_is_valid(setting: &NotificationSetting, value: &str) -> bool {\n    setting.choices().split(',').any(|c| c.trim() == value)\n}","typeGuard":null,"tryCatchPattern":"if notifications.apply_update(update).is_err() {\n    app.add_message(HistoryCell::System {\n        content: format!(\"Invalid value for notifications.{}; valid: {}\",\n            update.setting().key(), update.setting().choices()),\n    });\n    return Ok(()); // don't propagate, surface guidance instead\n}","preventionTips":["Read setting.choices() before submitting a notifications value","Use tab-completion or the config UI rather than free-typing values","Pin Codewhale versions in automation so accepted setting values don't drift"],"tags":["config","validation","notifications","invalid-value"],"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"}