Hmbown/CodeWhale · error

Failed to update setting: invalid composer vim mode

Error message

Failed to update setting: invalid composer vim mode '{value}'. Expected: normal, vim.

What it means

The settings setter rejected the value for `composer_vim_mode` (aliases `vim_mode`, `vim`). Only the lowercase strings vim or normal are accepted. The guard ensures the composer editing mode is one the input handlers implement.

Solutions

  1. Use `vim` to enable vim emulation or `normal` for default editing.
  2. Do not attempt other editor modes; only these two exist.
  3. Note the check compares against lowercase values after normalization, so case is fine but spelling must be exact.

Example fix

// before
settings.set("vim_mode", "emacs")
// after
settings.set("vim_mode", "vim")
Defensive patterns

Strategy: validation

Validate before calling

fn valid_vim_mode(v: &str) -> bool {
    matches!(v.trim().to_ascii_lowercase().as_str(), "vim" | "normal")
}

Try / catch

if let Err(e) = settings.set("composer_vim_mode", value) {
    eprintln!("{e}");
}

Prevention

When it happens

Trigger: Settings update with key `composer_vim_mode`, `vim_mode`, or `vim` and a value outside {vim, normal}, e.g. `set vim emacs`.

Common situations: Expecting other editor emulation modes (emacs, nano) that are not supported; uppercase `VIM` is handled by the to_ascii_lowercase, but misspellings are not.

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/31f592766f7e037e. Report an issue: GitHub.

Appendix: source

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

            "composer_density" | "composer" => {
                let normalized = normalize_composer_density(value);
                if !["compact", "comfortable", "spacious"].contains(&normalized) {
                    anyhow::bail!(
                        "Failed to update setting: invalid composer density '{value}'. Expected: compact, comfortable, spacious."
                    );
                }
                self.composer_density = normalized.to_string();
            }
            "composer_border" | "border" => {
                self.composer_border = parse_bool(value)?;
            }
            "composer_multiline_mode" | "multiline_mode" | "multiline" => {
                self.composer_multiline_mode = parse_bool(value)?;
            }
            "composer_vim_mode" | "vim_mode" | "vim" => {
                let normalized = value.trim().to_ascii_lowercase();
                if !["vim", "normal"].contains(&normalized.as_str()) {
                    anyhow::bail!(
                        "Failed to update setting: invalid composer vim mode '{value}'. Expected: normal, vim."
                    );
                }
                self.composer_vim_mode = normalized;
            }
            "transcript_spacing" | "spacing" => {
                let normalized = normalize_transcript_spacing(value);
                if !["compact", "comfortable", "spacious"].contains(&normalized) {
                    anyhow::bail!(
                        "Failed to update setting: invalid transcript spacing '{value}'. Expected: compact, comfortable, spacious."
                    );
                }
                self.transcript_spacing = normalized.to_string();
            }
            "status_indicator" | "indicator" => {
                let normalized = normalize_status_indicator(value);
                if !["cw", "whale", "dots", "off"].contains(&normalized) {
                    anyhow::bail!(

View on GitHub (pinned to 73e0f67d83)