{"record":{"id":"67a4e265d6f1603c","repo":"stalwartlabs/stalwart","slug":"missing","errorCode":null,"errorMessage":"Missing: {}","messagePattern":"Missing: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/common/build.rs","lineNumber":180,"sourceCode":"    let mut languages = std::collections::HashSet::new();\n    for translations in locales.values() {\n        for lang in translations.keys() {\n            languages.insert(lang.clone());\n        }\n    }\n\n    for lang in &languages {\n        code.push_str(&format!(\n            \"pub static {}_LOCALES: Locale = Locale {{\\n\",\n            const_name(lang)\n        ));\n        code.push_str(&format!(\"    name: {lang:?},\\n\"));\n        code.push_str(&format!(\"    direction: {:?},\\n\", direction(lang)));\n\n        for (key, translations) in locales {\n            let value = translations\n                .get(lang)\n                .unwrap_or_else(|| panic!(\"Missing: {}\", key));\n            if plural.contains(key) {\n                code.push_str(&format!(\"    {key}: {},\\n\", plural_forms_literal(value)));\n            } else {\n                code.push_str(&format!(\"    {key}: {value:?},\\n\"));\n            }\n        }\n\n        code.push_str(\"};\\n\\n\");\n    }\n\n    let mut sorted: Vec<&String> = languages.iter().collect();\n    sorted.sort_unstable();\n    code.push_str(&format!(\n        \"pub static ALL_LOCALES: [&Locale; {}] = [\\n\",\n        sorted.len()\n    ));\n    for lang in &sorted {\n        code.push_str(&format!(\"    &{}_LOCALES,\\n\", const_name(lang)));","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/stalwartlabs/stalwart/blob/e96200385781a6a9995a8b839ac27d6c75a983ee/crates/common/build.rs#L162-L198","documentation":"While emitting the generated locale constants, generate_locale_code iterates every translation key and fetches each language's value; a panic here means a key exists in the locales map but has no entry for the language currently being generated. The panic message names the offending key. In practice this indicates an inconsistent YAML where a top-level key defines no translation lines at all, so the key exists with an empty per-language map and every language misses it.","triggerScenarios":"A key header line in i18n.yml (e.g. `key.name:`) with no indented per-language entries under it, combined with another language having at least one translation — the empty map fails `.get(lang)` for every language during generation after plural_keys validation passes.","commonSituations":"A developer creates a placeholder key and forgets to fill in translations; an edit deletes all language lines under a key but leaves the header; a merge dropped indented lines while keeping the key.","solutions":["Add translation entries for the named key in i18n.yml for every supported language (at minimum the language cited in the build output).","If the key is unused, delete its header line entirely so the key is not registered.","Check indentation: language lines must be indented under the key header to be parsed as translations."],"exampleFix":"# before\nkey.new:\n# after\nkey.new:\n  en: Some text\n  de: Ein Text","handlingStrategy":"validation","validationCode":"// ensure every key has a value for every language before generation\nfor (key, translations) in &locales {\n    for lang in all_languages {\n        assert!(translations.contains_key(lang), \"key {key} missing translation for {lang}\");\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never leave a key header with no language lines; delete unused keys.","Check indentation carefully — unindented lines become keys, indented lines become translations.","Add a completeness check to CI that validates i18n.yml coverage before building."],"tags":["build-script","i18n","missing-translation"],"backgroundTag":"missing-required-config-field","analyzedSha":"e96200385781a6a9995a8b839ac27d6c75a983ee","analyzedAt":"2026-09-06T22:07:17.982Z","contentChangedAt":"2026-09-06T22:07:17.982Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}