Hmbown/CodeWhale · error

Failed to update setting

Error message

Failed to update setting: {err}

What it means

Thrown when a user-supplied reasoning-effort string fails ReasoningEffort::parse_strict while updating the setting via the settings update path. The inner parse error is wrapped with a uniform 'Failed to update setting' prefix.

Solutions

  1. Use one of the exact accepted reasoning-effort keywords (e.g. off/minimal/low/medium/high as defined by ReasoningEffort::parse_strict)
  2. Check the setting name and value spelling
  3. Run the update command interactively to see the accepted values

Example fix

// before
/settings reasoning-effort maximum
// after
/settings reasoning-effort high
Defensive patterns

Strategy: validation

Validate before calling

const EFFORTS: [&str; 5] = ["off", "minimal", "low", "medium", "high"];
fn is_valid_effort(v: &str) -> bool { EFFORTS.contains(&v.trim().to_lowercase().as_str()) }

Try / catch

match update_reasoning_effort(input) {
    Ok(v) => /* apply */,
    Err(e) => eprintln!("{e:#}; accepted values: off, minimal, low, medium, high"),
}

Prevention

When it happens

Trigger: Passing a value that is not a strictly valid reasoning-effort keyword (after trimming) to the setting-update command for reasoning effort.

Common situations: Typo like 'hig' or 'maximum'; capitalization/spacing variants not accepted by the strict parser; scripting the setting update with a wrong value.

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/53fd392cb44888dd. Report an issue: GitHub.

Appendix: source

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

        }
        _ => None,
    }
}

fn normalize_reasoning_effort_setting(value: &str) -> Result<Option<String>> {
    let trimmed = value.trim();
    if trimmed.is_empty()
        || matches!(
            trimmed.to_ascii_lowercase().as_str(),
            "default" | "(default)" | "config" | "configured" | "unset"
        )
    {
        return Ok(None);
    }

    ReasoningEffort::parse_strict(trimmed)
        .map(|effort| Some(effort.as_setting().to_string()))
        .map_err(|err| anyhow::anyhow!("Failed to update setting: {err}"))
}

/// Parse a boolean value from various formats
fn parse_bool(value: &str) -> Result<bool> {
    match value.to_lowercase().as_str() {
        "on" | "true" | "yes" | "1" | "enabled" => Ok(true),
        "off" | "false" | "no" | "0" | "disabled" => Ok(false),
        _ => {
            anyhow::bail!("Failed to parse boolean '{value}': expected on/off, true/false, yes/no.")
        }
    }
}

fn default_thinking_preview_lines() -> usize {
    2
}

fn default_true() -> bool {

View on GitHub (pinned to 73e0f67d83)