Hmbown/CodeWhale · error

Failed to update setting: invalid focus texture

Error message

Failed to update setting: invalid focus texture '{value}'. Expected: off, scrim, or grain.

What it means

The settings setter rejected the value given for the `focus_texture` setting. Only the exact strings off, scrim, or grain (case-insensitive, trimmed) are accepted. This is a validation guard in Settings::set so an unknown texture never enters persisted config.

Solutions

  1. Use one of: off, scrim, or grain (case-insensitive).
  2. Omit the setting entirely to keep the default.
  3. Check the accepted list in crates/tui/src/settings.rs around the focus_texture arm if unsure.

Example fix

// before
settings.set("texture", "frosted")
// after
settings.set("texture", "scrim")
Defensive patterns

Strategy: validation

Validate before calling

const FOCUS_TEXTURES: [&str; 3] = ["off", "scrim", "grain"];
fn valid_focus_texture(v: &str) -> bool {
    FOCUS_TEXTURES.contains(&v.trim().to_ascii_lowercase().as_str())
}

Try / catch

if let Err(e) = settings.set("focus_texture", value) {
    eprintln!("{e}; use one of: off, scrim, grain");
}

Prevention

When it happens

Trigger: Calling the settings update path with key `focus_texture` (alias `texture`) and a value outside {off, scrim, grain}, e.g. `set focus_texture blur`.

Common situations: Typing a visual effect name that does not exist; copying a value from a fork or newer/older build with different texture options; trailing whitespace or punctuation from a script.

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/0edd29f7b9680e80. Report an issue: GitHub.

Appendix: source

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

            "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)?;
            }
            "focus_texture" | "texture" => {
                let normalized = value.trim().to_ascii_lowercase();
                if !matches!(normalized.as_str(), "off" | "scrim" | "grain") {
                    anyhow::bail!(
                        "Failed to update setting: invalid focus texture '{value}'. Expected: off, scrim, or grain."
                    );
                }
                self.focus_texture = normalized;
            }
            "work_surface_placement" | "work_surface" | "work_rail" => {
                let normalized = value.trim().to_ascii_lowercase();
                if !matches!(
                    normalized.as_str(),
                    "top" | "bottom" | "left" | "right" | "off"
                ) {
                    anyhow::bail!(
                        "Failed to update setting: invalid work surface placement '{value}'. Expected: top, bottom, left, right, or off."
                    );
                }
                self.work_surface_placement = normalized;
            }
            "rail_panel" | "rail" => {

View on GitHub (pinned to 73e0f67d83)