{"record":{"id":"2f463f1f1eedceb4","repo":"zeroclaw-labs/zeroclaw","slug":"invalid-locale-code-locale","errorCode":null,"errorMessage":"invalid locale code '{locale}'","messagePattern":"invalid locale code '(.+?)'","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/main.rs","lineNumber":3299,"sourceCode":"    };\n\n    let mut cmd = cmd;\n    for name in &sub_names {\n        let child_prefix = format!(\"{prefix}-{name}\");\n        cmd = cmd.mut_subcommand(name, |sub| apply_cmd_translations(sub, &child_prefix));\n    }\n    cmd\n}\n\n#[cfg(feature = \"agent-runtime\")]\nfn validated_locale(locale: &str) -> Result<String> {\n    let ok_shape = !locale.is_empty()\n        && locale.len() <= 16\n        && locale\n            .chars()\n            .all(|c| c.is_ascii_alphanumeric() || c == '-');\n    if !ok_shape {\n        bail!(\"invalid locale code '{locale}'\");\n    }\n    let known = zeroclaw_runtime::i18n::available_locales();\n    if !known.iter().any(|o| o.code == locale) {\n        let codes: Vec<&str> = known.iter().map(|o| o.code.as_str()).collect();\n        bail!(\n            \"locale '{locale}' is not in the locales.toml registry; known: {}\",\n            codes.join(\", \")\n        );\n    }\n    Ok(locale.to_string())\n}\n\n#[cfg(feature = \"agent-runtime\")]\nasync fn fetch_locales(locale: &str, catalog: Option<&str>) -> Result<()> {\n    let locale = validated_locale(locale)?;\n\n    let selected: Vec<&(&str, &str, &str)> = match catalog {\n        None => zeroclaw_config::schema::FTL_CATALOGS.iter().collect(),","sourceCodeStart":3281,"sourceCodeEnd":3317,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/src/main.rs#L3281-L3317","documentation":"Error \"invalid locale code '{locale}'\" thrown in zeroclaw-labs/zeroclaw.","triggerScenarios":"Thrown at src/main.rs:3299 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a valid BCP-47 locale code such as `en`, `en-US`, or `zh-CN`.","List supported locales and pick one from the registry."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}