Hmbown/CodeWhale · error

Failed to update setting: invalid mention_menu_behavior '{va

Error message

Failed to update setting: invalid mention_menu_behavior '{value}'. Expected: fuzzy, browser.

What it means

Thrown by normalize_mention_menu_behavior when the mention_menu_behavior setting receives a value outside its alias table. 'fuzzy'/'default' normalize to fuzzy; 'browser'/'browse'/'file-browser'/'file_browser' normalize to browser. Everything else bails, naming the two canonical values.

Source

Thrown at crates/tui/src/settings.rs:2611

    let percent = trimmed.parse::<f64>().map_err(|_| {
        anyhow::anyhow!(
            "Failed to update setting: invalid {key} '{value}'. Expected a number from 10 to 100."
        )
    })?;
    if !(10.0..=100.0).contains(&percent) {
        anyhow::bail!(
            "Failed to update setting: invalid {key} '{value}'. Expected a number from 10 to 100."
        );
    }
    Ok(percent)
}

fn normalize_mention_menu_behavior(value: &str) -> Result<String> {
    match value.trim().to_ascii_lowercase().as_str() {
        "fuzzy" | "default" => Ok("fuzzy".to_string()),
        "browser" | "browse" | "file-browser" | "file_browser" => Ok("browser".to_string()),
        _ => {
            anyhow::bail!(
                "Failed to update setting: invalid mention_menu_behavior '{value}'. Expected: fuzzy, browser."
            )
        }
    }
}

fn normalize_mode(value: &str) -> &str {
    match value.trim().to_ascii_lowercase().as_str() {
        "edit" => "agent",
        "normal" => "agent",
        "agent" | "act" | "work" => "agent",
        "plan" => "plan",
        // Operate is a first-class startup mode (Hunter 2026-07-24).
        "operate" | "operation" | "ops" => "operate",
        // yolo was mode+permission; keep mode as Act and migrate posture on load.
        "yolo" => "agent",
        _ => value,
    }

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Set the value to the canonical 'fuzzy' or 'browser'.
  2. If you typed an alias, use one of browse, file-browser, file_browser, or default.
  3. Check for typos; the match is exact after lowercase and trim.
  4. Update stale dotfiles that carry an invented or outdated value name.

Example fix

# before
:set mention_menu_behavior file browser

# after
:set mention_menu_behavior file-browser
Defensive patterns

Strategy: validation

Validate before calling

fn valid_mention_behavior(v: &str) -> bool {
    matches!(
        v.trim().to_ascii_lowercase().as_str(),
        "fuzzy" | "default" | "browser" | "browse" | "file-browser" | "file_browser"
    )
}

Type guard

enum MentionBehavior { Fuzzy, Browser }

impl MentionBehavior {
    fn parse(v: &str) -> Option<Self> {
        match v.trim().to_ascii_lowercase().as_str() {
            "fuzzy" | "default" => Some(Self::Fuzzy),
            "browser" | "browse" | "file-browser" | "file_browser" => Some(Self::Browser),
            _ => None,
        }
    }
}

Prevention

When it happens

Trigger: ':set mention_menu_behavior popup', ':set mention_menu_behavior files', or a misspelling like 'browesr'. Note that 'file browser' with a space is rejected; only the hyphen/underscore alias forms are accepted.

Common situations: Users guessing the value from the feature rather than the enum, hyphen/space/underscore drift between docs and parser, and dotfiles copied from other tools whose mode names differ.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/cb1a7475f2895d93. Report an issue: GitHub.