Hmbown/CodeWhale · error · anyhow::Error
Failed to update setting: invalid ocean treatment '{value}'.
Error message
Failed to update setting: invalid ocean treatment '{value}'. Expected: ombre or flat. What it means
SettingsStore.update validates appearance values before assigning: ocean_treatment must be one of ombre or flat (compared after trim + ASCII lowercase) (crates/tui/src/settings.rs:1245). Any other string is rejected with this message and the setting is left unchanged.
Source
Thrown at crates/tui/src/settings.rs:1245
"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)?;
}
"ocean_treatment" | "treatment" | "background_treatment" => {
let normalized = value.trim().to_ascii_lowercase();
if !matches!(normalized.as_str(), "ombre" | "flat") {
anyhow::bail!(
"Failed to update setting: invalid ocean treatment '{value}'. Expected: ombre or flat."
);
}
self.ocean_treatment = normalized;
}
"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" | "left" | "right" | "off") {
anyhow::bail!(View on GitHub (pinned to 0c42157ee5)
Solutions
- Use exactly ombre or flat (any casing; it is normalized)
- Check the current version's allowed values before writing settings programmatically
- Map or drop legacy values during config migration instead of passing them through
- If a saved config contains an old value, edit it to a supported one
Example fix
// before
settings.update("treatment", "waves")?; // invalid
// after
settings.update("treatment", "ombre")?; // or "flat" Defensive patterns
Strategy: type-guard
Validate before calling
// Validate before updating.
let v = value.trim().to_ascii_lowercase();
if !matches!(v.as_str(), "ombre" | "flat") {
return Err(anyhow::anyhow!("unsupported ocean treatment"));
}
settings.update("ocean_treatment", &v)?; Type guard
fn is_valid_ocean_treatment(value: &str) -> bool {
matches!(value.trim().to_ascii_lowercase().as_str(), "ombre" | "flat")
} Try / catch
match settings.update("ocean_treatment", value) {
Ok(()) => {}
Err(err) if err.to_string().contains("invalid ocean treatment") => {
settings.update("ocean_treatment", default_ocean_treatment())?;
}
Err(err) => return Err(err),
} Prevention
- Bind UI controls to a fixed list: ombre, flat
- Normalize (trim + lowercase) user input before passing it in
- Re-validate imported config files against the current allowed values and reset invalid entries
- Re-check the option vocabulary after version upgrades — names change
When it happens
Trigger: Calling /set treatment wave (or settings.update("ocean_treatment", ...)) with an unsupported value; a config file hand-edited with a removed or renamed option value after an upgrade; scripts passing values from an older version's vocabulary
Common situations: Version upgrades that renamed or removed background treatments; user guessing plausible values; automation copying settings between versions without mapping.
Related errors
- Failed to update setting: invalid focus texture '{value}'. E
- Failed to update setting: invalid work surface placement '{v
- Failed to parse boolean '{value}': expected on/off, true/fal
- Invalid {key} '{value}': expected {min}-{max}
- Failed to update setting: invalid {key} '{value}'. Expected
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/a17decbc16b2b995.
Report an issue: GitHub.