Hmbown/CodeWhale · error · anyhow::Error

invalid theme '{value}'

Error message

invalid theme '{value}'

What it means

Thrown by UiThemeValue::from_setting when normalize_theme_name returns None: the string does not match any built-in theme or alias, and it is not a valid custom user-theme selector (that path returns Custom earlier). This is the catch-all for unrecognized theme names.

Source

Thrown at crates/tui/src/config_ui.rs:1128

        if crate::palette::normalize_user_theme_selector(value)
            .map_err(anyhow::Error::msg)?
            .is_some()
        {
            return Ok(Self::Custom);
        }
        match crate::palette::normalize_theme_name(value) {
            Some("system") => Ok(Self::System),
            Some("dark") => Ok(Self::Dark),
            Some("light") => Ok(Self::Light),
            Some("grayscale") => Ok(Self::Grayscale),
            Some("catppuccin-mocha") => Ok(Self::CatppuccinMocha),
            Some("tokyo-night") => Ok(Self::TokyoNight),
            Some("dracula") => Ok(Self::Dracula),
            Some("gruvbox-dark") => Ok(Self::GruvboxDark),
            Some("matrix") => Ok(Self::Matrix),
            Some("uwu") => Ok(Self::Uwu),
            Some(other) => bail!("unsupported theme '{other}'"),
            None => bail!("invalid theme '{value}'"),
        }
    }
}

impl OceanTreatmentValue {
    fn as_setting(self) -> &'static str {
        match self {
            Self::Ombre => "ombre",
            Self::Flat => "flat",
        }
    }
}

impl From<&str> for OceanTreatmentValue {
    fn from(value: &str) -> Self {
        if value.trim().eq_ignore_ascii_case("flat") {
            Self::Flat
        } else {

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Use a supported name: system, dark, light, grayscale, catppuccin-mocha, tokyo-night, dracula, gruvbox-dark, matrix, uwu (aliases like catppuccin, tokyonight, gruvbox, owo also work)
  2. If you want a custom palette, configure it as a custom user theme rather than a built-in name
  3. Check the exact spelling and dashes in the config value

Example fix

# before
theme = "nord"

# after
theme = "tokyo-night"
Defensive patterns

Strategy: validation

Validate before calling

fn is_known_theme(value: &str) -> bool {
    crate::palette::normalize_theme_name(value).is_some()
}

Prevention

When it happens

Trigger: Setting theme to a name with no alias mapping, e.g. "nord", "onedark", or a typo like "dracul". Also fires for values that fail both normalize_user_theme_selector and normalize_theme_name.

Common situations: Hand-editing the config with a theme from another terminal app; typos; expecting a theme name that a different tool uses.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/27ffb272d8824aca. Report an issue: GitHub.