{"record":{"id":"5e09a46ac95ce6cd","repo":"Hmbown/CodeWhale","slug":"configcommandinvalidvalue","errorCode":"ConfigCommandInvalidValue","errorMessage":"notifications.{key}: {value} (choices: {choices})","messagePattern":"notifications\\.(.+?): (.+?) \\(choices: (.+?)\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","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/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/crates/tui/src/tui/ui/apply.rs#L1254-L1290","documentation":"apply_notification_update applies a NotificationConfigUpdate to the live notifications config. When notifications.apply_update rejects the value (invalid setting or out-of-choice value), the error message is localized (MessageId::ConfigCommandInvalidValue) and interpolated with the setting key, the unusable value, and the accepted choices list. It carries code ConfigCommandInvalidValue so the config-command layer can classify it.","triggerScenarios":"Calling apply_notification_update (from apply_command_result or a live notification config delta) with an update whose value is not among setting.choices() — e.g. setting notifications.<key> to a string that isn't one of the allowed enumerated choices.","commonSituations":"Typing an invalid value in the config command (e.g. notifications.sound=bell when choices are on/off); live config deltas from external editors using stale or wrong value names; locale-dependent message rendering showing 'unavailable' for the bad value.","solutions":["Use one of the listed choices shown in the error message when setting notifications.<key>.","Validate the value against setting.choices() before constructing NotificationConfigUpdate.","If a live delta came from an edited config file, fix the offending value there and reload.","Check for typos/case differences between the provided value and the enumerated choices."],"exampleFix":"// before\nlet update = NotificationConfigUpdate::new(\"sound\", user_value);\napply_notification_update(app, config, update)?;\n// after — validate first\nlet update = NotificationConfigUpdate::new(\"sound\", user_value);\nif !update.setting().choices().split(',').any(|c| c.trim() == user_value) {\n    app.add_message(format!(\"notifications.sound must be one of: {}\", update.setting().choices()));\n    return Ok(());\n}\napply_notification_update(app, config, update)?;","handlingStrategy":"validation","validationCode":"let choices: Vec<&str> = setting.choices().split(',').map(str::trim).collect();\nif !choices.contains(&provided_value.as_str()) {\n    return Err(anyhow!(\"notifications.{} must be one of: {}\", setting.key(), setting.choices()));\n}","typeGuard":"fn is_valid_choice(value: &str, setting: &NotificationSetting) -> bool { setting.choices().split(',').any(|c| c.trim() == value) }","tryCatchPattern":"match notifications.apply_update(update) {\n    Ok(()) => {},\n    Err(_) => show_localized_invalid_value(setting.key(), setting.choices()),\n}","preventionTips":["Use the same enumerated strings shown in the error's choices list when setting notifications.* values.","Validate external config edits against setting.choices() before applying live deltas.","Watch for case sensitivity and whitespace in values passed to NotificationConfigUpdate."],"tags":["config","validation","notifications","invalid-value"],"backgroundTag":"invalid-config-value","analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}