{"record":{"id":"7b0ecb34d90781c7","repo":"Hmbown/CodeWhale","slug":"unknown-preset-available-presets-calm","errorCode":null,"errorMessage":"Unknown preset '{}'. Available presets: calm","messagePattern":"Unknown preset '(.+?)'\\. Available presets: calm","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/settings.rs","lineNumber":1786,"sourceCode":"        }\n        Ok(())\n    }\n\n    /// Apply a named settings preset (#3478).\n    ///\n    /// Presets are the first bundled-settings mechanism: a single name applies a\n    /// coherent group of presentation knobs. `calm` is the \"beautiful/calm\n    /// transcript\" preset — it quiets motion and verbose tool output while\n    /// **keeping evidence reachable**: thinking stays visible and tool runs stay\n    /// expandable (only their inline detail is collapsed), so maintainer/release\n    /// work is never blind to failures. Presentation only — no model, provider,\n    /// routing, or safety setting is touched. Reuses [`Settings::set`] so each\n    /// field goes through the same validation as a single-key set.\n    ///\n    /// Returns the keys changed, or an error for an unknown preset.\n    pub fn apply_preset(&mut self, name: &str) -> Result<Vec<&'static str>> {\n        let Some(bundle) = preset_fields(name) else {\n            anyhow::bail!(\"Unknown preset '{}'. Available presets: calm\", name.trim());\n        };\n        let mut changed = Vec::with_capacity(bundle.len());\n        for (key, value) in bundle {\n            self.set(key, value)?;\n            changed.push(*key);\n        }\n        Ok(changed)\n    }\n\n    /// Get all settings as a displayable string\n    pub fn display(&self, locale: codewhale_localization::Locale) -> String {\n        use codewhale_localization::{MessageId, tr};\n        let mut lines = Vec::new();\n        lines.push(tr(locale, MessageId::SettingsTitle).to_string());\n        lines.push(\"─────────────────────────────\".to_string());\n        lines.push(format!(\"  auto_compact:       {}\", self.auto_compact));\n        lines.push(format!(\n            \"  auto_compact_pct:   {:.0}\",","sourceCodeStart":1768,"sourceCodeEnd":1804,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/settings.rs#L1768-L1804","documentation":"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).","triggerScenarios":"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.","commonSituations":"Users guessing preset names, blog posts or docs from forks listing more presets, or typos like `calm-mode` / `Calm`.","solutions":["Use the preset name `calm`.","Inspect preset_fields in crates/tui/src/settings.rs to see the current preset catalog before scripting.","Apply individual settings via Settings::set if no preset matches your need."],"exampleFix":"// before\nsettings.apply_preset(\"quiet\")?;\n// after\nlet changed = settings.apply_preset(\"calm\")?;","handlingStrategy":"validation","validationCode":"fn valid_preset(name: &str) -> bool {\n    name.trim().eq_ignore_ascii_case(\"calm\")\n}","typeGuard":null,"tryCatchPattern":"match settings.apply_preset(name) {\n    Err(e) if e.to_string().starts_with(\"Unknown preset\") => eprintln!(\"only 'calm' exists today\"),\n    r => r?,\n}","preventionTips":["Check preset_fields in settings.rs for the live preset list before scripting.","Treat preset names as a closed set until new ones are released.","Fall back to individual Settings::set calls when the preset is unknown."],"tags":["rust","configuration","presets"],"backgroundTag":"resource-not-found","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}