zeroclaw-labs/zeroclaw · error · anyhow::Error

invalid locale code '{locale}'

Error message

invalid locale code '{locale}'

What it means

Error "invalid locale code '{locale}'" thrown in zeroclaw-labs/zeroclaw.

Source

Thrown at src/main.rs:3299

    };

    let mut cmd = cmd;
    for name in &sub_names {
        let child_prefix = format!("{prefix}-{name}");
        cmd = cmd.mut_subcommand(name, |sub| apply_cmd_translations(sub, &child_prefix));
    }
    cmd
}

#[cfg(feature = "agent-runtime")]
fn validated_locale(locale: &str) -> Result<String> {
    let ok_shape = !locale.is_empty()
        && locale.len() <= 16
        && locale
            .chars()
            .all(|c| c.is_ascii_alphanumeric() || c == '-');
    if !ok_shape {
        bail!("invalid locale code '{locale}'");
    }
    let known = zeroclaw_runtime::i18n::available_locales();
    if !known.iter().any(|o| o.code == locale) {
        let codes: Vec<&str> = known.iter().map(|o| o.code.as_str()).collect();
        bail!(
            "locale '{locale}' is not in the locales.toml registry; known: {}",
            codes.join(", ")
        );
    }
    Ok(locale.to_string())
}

#[cfg(feature = "agent-runtime")]
async fn fetch_locales(locale: &str, catalog: Option<&str>) -> Result<()> {
    let locale = validated_locale(locale)?;

    let selected: Vec<&(&str, &str, &str)> = match catalog {
        None => zeroclaw_config::schema::FTL_CATALOGS.iter().collect(),

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Use a valid BCP-47 locale code such as `en`, `en-US`, or `zh-CN`.
  2. List supported locales and pick one from the registry.

When it happens

Trigger: Thrown at src/main.rs:3299 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/2f463f1f1eedceb4. Report an issue: GitHub.