Hmbown/CodeWhale · error

Unknown preset ' '. Available presets: calm

Error message

Unknown preset '{}'. Available presets: calm

What it means

Settings::apply_preset resolves a preset name through preset_fields(name); when no bundle matches it bails with this error naming the available presets. Currently only `calm` exists — a presentation-only bundle (quiets motion and tool detail while keeping thinking visible and tool runs expandable).

Solutions

  1. Use the preset name `calm`.
  2. Inspect preset_fields in crates/tui/src/settings.rs to see the current preset catalog before scripting.
  3. Apply individual settings via Settings::set if no preset matches your need.

Example fix

// before
settings.apply_preset("quiet")?;
// after
let changed = settings.apply_preset("calm")?;
Defensive patterns

Strategy: validation

Validate before calling

fn valid_preset(name: &str) -> bool {
    name.trim().eq_ignore_ascii_case("calm")
}

Try / catch

match settings.apply_preset(name) {
    Err(e) if e.to_string().starts_with("Unknown preset") => eprintln!("only 'calm' exists today"),
    r => r?,
}

Prevention

When it happens

Trigger: apply_preset("relaxed") or any name other than `calm` — e.g. `/config preset quiet`, scripted preset application, or calling the public API with an empty/whitespace-only name.

Common situations: Users guessing preset names, blog posts or docs from forks listing more presets, or typos like `calm-mode` / `Calm`.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/7b0ecb34d90781c7. Report an issue: GitHub.

Appendix: source

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

        }
        Ok(())
    }

    /// Apply a named settings preset (#3478).
    ///
    /// Presets are the first bundled-settings mechanism: a single name applies a
    /// coherent group of presentation knobs. `calm` is the "beautiful/calm
    /// transcript" preset — it quiets motion and verbose tool output while
    /// **keeping evidence reachable**: thinking stays visible and tool runs stay
    /// expandable (only their inline detail is collapsed), so maintainer/release
    /// work is never blind to failures. Presentation only — no model, provider,
    /// routing, or safety setting is touched. Reuses [`Settings::set`] so each
    /// field goes through the same validation as a single-key set.
    ///
    /// Returns the keys changed, or an error for an unknown preset.
    pub fn apply_preset(&mut self, name: &str) -> Result<Vec<&'static str>> {
        let Some(bundle) = preset_fields(name) else {
            anyhow::bail!("Unknown preset '{}'. Available presets: calm", name.trim());
        };
        let mut changed = Vec::with_capacity(bundle.len());
        for (key, value) in bundle {
            self.set(key, value)?;
            changed.push(*key);
        }
        Ok(changed)
    }

    /// Get all settings as a displayable string
    pub fn display(&self, locale: codewhale_localization::Locale) -> String {
        use codewhale_localization::{MessageId, tr};
        let mut lines = Vec::new();
        lines.push(tr(locale, MessageId::SettingsTitle).to_string());
        lines.push("─────────────────────────────".to_string());
        lines.push(format!("  auto_compact:       {}", self.auto_compact));
        lines.push(format!(
            "  auto_compact_pct:   {:.0}",

View on GitHub (pinned to 73e0f67d83)