Hmbown/CodeWhale · error · anyhow::Error

unsupported locale '{other}'

Error message

unsupported locale '{other}'

What it means

Thrown by UiLocaleValue::from_setting when normalize_configured_locale (crates/tui/src/localization.rs:3556) successfully parses the input into a canonical locale tag that the config-UI enum does not cover. The selectable set is exactly: auto, en, ja, zh-Hans, zh-Hant, pt-BR, es-419, vi, ko, ca, de, fr, id, hi, ru, uk. Because as_setting() and from_setting() list the same tags, this arm only fires on version skew: the localization parser knows a tag that this config_ui.rs build has not added yet.

Source

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

    fn from_setting(value: &str) -> Result<Self> {
        match normalize_configured_locale(value) {
            Some("auto") => Ok(Self::Auto),
            Some("en") => Ok(Self::En),
            Some("ja") => Ok(Self::Ja),
            Some("zh-Hans") => Ok(Self::ZhHans),
            Some("zh-Hant") => Ok(Self::ZhHant),
            Some("pt-BR") => Ok(Self::PtBr),
            Some("es-419") => Ok(Self::Es419),
            Some("vi") => Ok(Self::Vi),
            Some("ko") => Ok(Self::Ko),
            Some("ca") => Ok(Self::Ca),
            Some("de") => Ok(Self::De),
            Some("fr") => Ok(Self::Fr),
            Some("id") => Ok(Self::Id),
            Some("hi") => Ok(Self::Hi),
            Some("ru") => Ok(Self::Ru),
            Some("uk") => Ok(Self::Uk),
            Some(other) => bail!("unsupported locale '{other}'"),
            None => bail!("invalid locale '{value}'"),
        }
    }
}

impl UiThemeValue {
    fn as_setting(self) -> &'static str {
        match self {
            Self::System => "system",
            Self::Dark => "dark",
            Self::Light => "light",
            Self::Grayscale => "grayscale",
            Self::CatppuccinMocha => "catppuccin-mocha",
            Self::TokyoNight => "tokyo-night",
            Self::Dracula => "dracula",
            Self::GruvboxDark => "gruvbox-dark",
            Self::Matrix => "matrix",
            Self::Uwu => "uwu",

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Set the locale setting to one of the listed values (auto, en, ja, zh-Hans, zh-Hant, pt-BR, es-419, vi, ko, ca, de, fr, id, hi, ru, uk)
  2. Upgrade Codewhale so config_ui.rs matches the localization data that recognizes the tag
  3. Set locale to "auto" to fall back to system detection while you reconcile versions

Example fix

# before
locale = "en-US-x-new"

# after
locale = "en"
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED_LOCALES: &[&str] = &["auto", "en", "ja", "zh-Hans", "zh-Hant", "pt-BR", "es-419", "vi", "ko", "ca", "de", "fr", "id", "hi", "ru", "uk"];

fn locale_is_selectable(value: &str) -> bool {
    crate::localization::normalize_configured_locale(value)
        .is_some_and(|tag| SUPPORTED_LOCALES.contains(&tag))
}

// before saving the setting:
if !locale_is_selectable(new_locale) {
    return Ok(()); // keep the old value, surface supported list to the user
}

Prevention

When it happens

Trigger: Running an older codewhale binary against a config written by a newer release that shipped a new locale pack; a locale input that normalizes to a tag present in localization.rs but absent from the from_setting match in config_ui.rs:1068.

Common situations: Downgrading or partially upgrading the TUI; reusing a dotfile/config synced from a machine running a newer Codewhale; a new locale landing in localization.rs before config_ui.rs picks it up.

Related errors


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