Hmbown/CodeWhale · error
Failed to update setting: invalid composer density
Error message
Failed to update setting: invalid composer density '{value}'. Expected: compact, comfortable, spacious. What it means
The settings setter rejected the value for `composer_density` (alias `composer`). normalize_composer_density must return one of compact, comfortable, or spacious; anything else is rejected. This keeps the composer's visual density within the three supported levels.
Solutions
- Use one of: compact, comfortable, spacious.
- Check the spelling; normalization handles case but not typos.
- Inspect normalize_composer_density in settings.rs to see exactly what aliases collapse to these three values.
Example fix
// before
settings.set("composer_density", "cozy")
// after
settings.set("composer_density", "comfortable") Defensive patterns
Strategy: validation
Validate before calling
const DENSITIES: [&str; 3] = ["compact", "comfortable", "spacious"];
fn valid_composer_density(v: &str) -> bool {
DENSITIES.contains(&v.trim().to_ascii_lowercase().as_str())
} Try / catch
if let Err(e) = settings.set("composer_density", value) {
eprintln!("{e}");
} Prevention
- Only the three density keywords exist; do not invent levels.
- Reuse the same density constant as transcript_spacing.
- Fix typos like `comfotable`; case is normalized but spelling is not.
When it happens
Trigger: Settings update with key `composer_density` or `composer` and a value outside {compact, comfortable, spacious}, e.g. `set composer cozy`.
Common situations: Inventing a fourth density level; typos like `comfotable`; copying density names from editors (VS Code uses similar terms but not identical).
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
- Failed to update setting: invalid focus texture
- Failed to update setting: invalid transcript spacing
- Failed to update setting: invalid work surface placement
- Failed to update setting: invalid workbar panel
- Invalid tui.alternate_screen
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/a5201c6061e58292.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/settings.rs:1645
"locale" | "language" => {
let Some(locale) = normalize_configured_locale(value) else {
anyhow::bail!(
"Failed to update setting: invalid locale '{value}'. Expected: {}.",
codewhale_localization::configured_locale_values(", ")
);
};
self.locale = locale.to_string();
}
"theme" | "ui_theme" => {
self.theme = normalize_theme_setting(value).map_err(anyhow::Error::msg)?;
}
"background_color" | "background" | "bg" => {
self.background_color = normalize_background_color_setting(value)?;
}
"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."
);
}View on GitHub (pinned to 73e0f67d83)