{"record":{"id":"88ad6a5b003b70b7","repo":"microsoft/edit","slug":"invalid-language","errorCode":null,"errorMessage":"invalid language: \"{}\"","messagePattern":"invalid language: \"(.+?)\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/unicode-gen/src/main.rs","lineNumber":266,"sourceCode":"  --no-ambiguous        Treat all ambiguous characters as narrow\n  --line-breaks         Store and expose line break information\n\nDownload ucd.nounihan.grouped.xml at:\n  https://www.unicode.org/Public/UCD/latest/ucdxml/ucd.nounihan.grouped.zip\n\";\n\nfn main() -> anyhow::Result<()> {\n    let mut args = pico_args::Arguments::from_env();\n    if args.contains([\"-h\", \"--help\"]) {\n        eprint!(\"{HELP}\");\n        return Ok(());\n    }\n\n    let mut out = Output {\n        arg_lang: args.value_from_fn(\"--lang\", |arg| match arg {\n            \"c\" => Ok(Language::C),\n            \"rust\" => Ok(Language::Rust),\n            l => bail!(\"invalid language: \\\"{}\\\"\", l),\n        })?,\n        arg_extended: args.contains(\"--extended\"),\n        arg_no_ambiguous: args.contains(\"--no-ambiguous\"),\n        arg_line_breaks: args.contains(\"--line-breaks\"),\n        ..Default::default()\n    };\n    let arg_input = args.free_from_os_str(|s| -> Result<PathBuf, &'static str> { Ok(s.into()) })?;\n    let arg_remaining = args.finish();\n    if !arg_remaining.is_empty() {\n        bail!(\"unrecognized arguments: {:?}\", arg_remaining);\n    }\n\n    let input = std::fs::read_to_string(arg_input)?;\n    let doc = roxmltree::Document::parse(&input)?;\n    out.ucd = extract_values_from_ucd(&doc, &out)?;\n\n    // Find the best trie configuration over the given block sizes (2^2 - 2^8) and stages (4).\n    // More stages = Less size. The trajectory roughly follows a+b*c^stages, where c < 1.","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/microsoft/edit/blob/826b4c097b6f14ba0a846dc56f2f0223a3aaf73a/crates/unicode-gen/src/main.rs#L248-L284","documentation":"unicode-gen parses --lang with value_from_fn, accepting only \"c\" and \"rust\". Any other value is rejected with `invalid language: \"{}\"`. This guards generation of Unicode tables to the two supported source-language targets.","triggerScenarios":"Running unicode-gen with --lang set to anything other than `c` or `rust`, e.g. --lang=cpp, --lang=python, or a misspelling like --lang=Rust (case-sensitive).","commonSituations":"Assuming other output languages are supported; shell completion offering stale values; case mistakes since the matcher is exact lowercase.","solutions":["Use --lang c or --lang rust exactly (lowercase).","If you need another target, extend the match arm in main.rs to map the new string to a Language variant.","Check the binary's usage/help for the supported language list."],"exampleFix":"// before\nunicode-gen --lang=cpp GraphemeBreakProperty.txt\n// after\nunicode-gen --lang=c GraphemeBreakProperty.txt","handlingStrategy":"validation","validationCode":"const SUPPORTED: &[&str] = &[\"c\", \"rust\"];\nlet lang = std::env::args().find(|a| a.starts_with(\"--lang\")).map(|a| a.split('=').nth(1).unwrap_or(\"\")).unwrap_or(\"\");\nassert!(SUPPORTED.contains(&lang), \"--lang must be c or rust, got {lang}\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only pass --lang c or --lang rust (exact lowercase).","Pin the unicode-gen invocation in scripts/Makefiles with the fixed valid value.","If a new target is needed, extend the Language enum in the generator source first."],"tags":["cli","enum","invalid-value"],"backgroundTag":"invalid-enum-argument","analyzedSha":"826b4c097b6f14ba0a846dc56f2f0223a3aaf73a","analyzedAt":"2026-09-06T13:30:05.543Z","contentChangedAt":"2026-09-06T13:30:05.543Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}