Hmbown/CodeWhale · warning

Can't use ' ' for . Try: .

Error message

Can't use '{value}' for {key}. Try: {choices}.

What it means

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.

Solutions

  1. Use one of the listed valid choices for notifications.<setting> (the message includes them via setting.choices())
  2. Check the NotificationConfigUpdate construction site for a wrong/renamed value
  3. Update Codewhale if the setting's accepted values changed in a newer version

Example fix

// before
apply_command_result(app, "/config notifications.sound maybe")?;
// after
apply_command_result(app, "/config notifications.sound on")?; // use a listed choice
Defensive patterns

Strategy: validation

Validate before calling

// Validate against the setting's choices before applying
fn value_is_valid(setting: &NotificationSetting, value: &str) -> bool {
    setting.choices().split(',').any(|c| c.trim() == value)
}

Try / catch

if notifications.apply_update(update).is_err() {
    app.add_message(HistoryCell::System {
        content: format!("Invalid value for notifications.{}; valid: {}",
            update.setting().key(), update.setting().choices()),
    });
    return Ok(()); // don't propagate, surface guidance instead
}

Prevention

When it happens

Trigger: 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.

Common situations: Typing /config notifications.<setting> <bad value>; a plugin or automation pushing an unsupported notifications value; locale string placeholders ({key}/{value}/{choices}) mismatching user expectation.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/c483549f1badbd91. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/tui/ui/apply.rs:1272

        // toggling the stale flag off.
        app.voice_enabled = false;
    }
    let notice = app
        .tr(MessageId::SettingLockedDuringTurn)
        .replace("{setting}", "Codewhale Runtime");
    app.push_status_toast(notice, crate::tui::app::StatusToastLevel::Info, Some(6_000));
    true
}

pub(crate) fn apply_notification_update(
    app: &mut App,
    config: &mut Config,
    update: crate::config::NotificationConfigUpdate,
) -> Result<()> {
    let mut notifications = config.notifications_config();
    let setting = update.setting();
    notifications.apply_update(update).map_err(|_| {
        anyhow::anyhow!(
            app.tr(MessageId::ConfigCommandInvalidValue)
                .replace("{key}", &format!("notifications.{}", setting.key()))
                .replace("{value}", &app.tr(MessageId::ConfigUnavailable))
                .replace("{choices}", setting.choices())
        )
    })?;
    config.notifications = Some(notifications);
    app.refresh_notification_settings(config);
    Ok(())
}

pub(crate) async fn apply_command_result(
    terminal: &mut AppTerminal,
    app: &mut App,
    engine_handle: &mut EngineHandle,
    task_manager: &SharedTaskManager,
    config: &mut Config,
    result: commands::CommandResult,

View on GitHub (pinned to 73e0f67d83)