Hmbown/CodeWhale · error
Failed to update setting: unknown setting
Error message
Failed to update setting: unknown setting '{key}'. What it means
The catch-all arm of Settings::set's key match: any setting key that is not one of the handled names (or their aliases) bails with this error. The setter is the single validation funnel for /config writes and presets (apply_preset reuses it), so this also surfaces for typos inside a preset bundle.
Solutions
- Run the settings display (e.g. /config with no args) to list valid keys.
- Check the match arms in Settings::set (crates/tui/src/settings.rs) for the exact key and its aliases.
- Keys like default_model are intentionally rejected — see their specific redirect errors.
Example fix
// before
settings.set("themes", "dark")?;
// after
settings.set("status_indicator", "cw")?; // pick a real settings key Defensive patterns
Strategy: validation
Validate before calling
const SETTING_KEYS: [&str; 20] = ["status_indicator", "indicator", "synchronized_output", "sync_output", "sync", "default_mode", "mode", "cost_currency", "currency", "max_history", "history", "reasoning_effort", "effort", "permission_posture", "permissions", "sandbox_mode", "sandbox", "transcript_spacing", "spacing", "context_panel"];
fn is_known_setting(key: &str) -> bool {
SETTING_KEYS.contains(&key)
} Try / catch
match settings.set(key, value) {
Err(e) if e.to_string().contains("unknown setting") => eprintln!("run /config to list valid settings"),
r => r?,
} Prevention
- Maintain a key allowlist in wrapper scripts mirroring the setter's match arms.
- Prefer the settings display output over guessing key names.
- Grep settings.rs match arms when adding new keys to scripts.
When it happens
Trigger: Settings::set(key, _) with an unknown key — e.g. `/config color_theme dark` (not a settings key), misspellings like `maxhistory` or `synced_output`, or keys that belong to config.toml rather than session settings.
Common situations: Guessing setting names from memory, porting keys from other tools (theme, font_size), or applying a preset whose bundle references a renamed key after a refactor.
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
- A pinned task provider requires an explicit model
- Failed to update setting: invalid cost currency
- Failed to update setting: invalid mode
- Failed to update setting: invalid ocean treatment
- Failed to update setting: invalid permission posture
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/afbde4dc97ce2f8b.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/settings.rs:1762
}
"permission_posture" | "permissions" => {
self.permission_posture = normalize_permission_posture(value);
if self.permission_posture.is_none() {
anyhow::bail!(
"Failed to update setting: invalid permission posture '{value}'. Expected: ask, auto-review, or full-access."
);
}
}
"sandbox_mode" | "sandbox" | "filesystem_sandbox" => {
self.sandbox_mode = normalize_sandbox_mode(value);
if self.sandbox_mode.is_none() {
anyhow::bail!(
"Failed to update setting: invalid sandbox_mode '{value}'. Expected: read-only, workspace-write, danger-full-access, or external-sandbox."
);
}
}
_ => {
anyhow::bail!("Failed to update setting: unknown setting '{key}'.");
}
}
if let Some(canonical) = canonical {
self.provenance
.insert(canonical.to_string(), Layer::SessionOverride);
}
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 eachView on GitHub (pinned to 73e0f67d83)