Hmbown/CodeWhale · error · anyhow::Error

Failed to update setting: invalid tool collapse mode '{value

Error message

Failed to update setting: invalid tool collapse mode '{value}'. Expected: compact, expanded, or calm.

What it means

Validation branch in Settings::set for the tool collapse mode keys: the supplied value did not parse as one of the accepted modes (compact, expanded, calm). It is a user-input error from /config-style setting updates, not a system failure — the setting is left unchanged.

Source

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

    pub fn set(&mut self, key: &str, value: &str) -> Result<()> {
        match key {
            "auto_compact" | "compact" => {
                self.auto_compact = parse_bool(value)?;
                self.auto_compact_explicit = true;
            }
            "auto_compact_threshold" | "auto_compact_threshold_percent" => {
                self.auto_compact_threshold_percent =
                    parse_percent_setting("auto_compact_threshold_percent", value)?;
                self.auto_compact = true;
                self.auto_compact_explicit = true;
            }
            "calm_mode" | "calm" => {
                self.calm_mode = parse_bool(value)?;
            }
            "tool_collapse" | "tool_collapse_mode" | "collapse" => {
                let normalized = normalize_tool_collapse_mode(value);
                if !matches!(normalized, "compact" | "expanded" | "calm") {
                    return Err(anyhow::anyhow!(
                        "Failed to update setting: invalid tool collapse mode '{value}'. Expected: compact, expanded, or calm."
                    ));
                }
                self.tool_collapse_mode = normalized.to_string();
            }
            "low_motion" | "motion" => {
                self.low_motion = parse_bool(value)?;
            }
            "fancy_animations" | "fancy" | "animations" => {
                self.fancy_animations = parse_bool(value)?;
            }
            "ocean_treatment" | "treatment" | "background_treatment" => {
                let normalized = value.trim().to_ascii_lowercase();
                if !matches!(normalized.as_str(), "ombre" | "flat") {
                    anyhow::bail!(
                        "Failed to update setting: invalid ocean treatment '{value}'. Expected: ombre or flat."
                    );
                }

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Use one of the accepted values: compact, expanded, or calm
  2. Check for typos, quoting artifacts, or trailing whitespace in the value
  3. Run the config listing to see the current valid value before updating
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/tui/src/settings.rs:1230 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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