{"record":{"id":"4da3d13532da2075","repo":"microsoft/edit","slug":"no-highlighting-definition-found-for-language-lan","errorCode":null,"errorMessage":"No highlighting definition found for language {language:?}","messagePattern":"No highlighting definition found for language (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/lsh-bin/src/main.rs","lineNumber":118,"sourceCode":"        SubCommands::Render(cmd) => {\n            read_lsh_inputs(&cmd.lsh)?;\n            run_render(generator, cmd.input.as_deref(), cmd.language.as_deref())?;\n        }\n    }\n\n    Ok(())\n}\n\nfn run_render(\n    generator: lsh::compiler::Generator,\n    path: Option<&Path>,\n    language: Option<&str>,\n) -> anyhow::Result<()> {\n    let assembly = generator.assemble()?;\n\n    let entrypoint = if let Some(language) = language {\n        assembly.entrypoints.iter().find(|ep| ep.name.replace('_', \"-\") == language).ok_or_else(\n            || anyhow::anyhow!(\"No highlighting definition found for language {language:?}\"),\n        )?\n    } else if let Some(path) = path {\n        assembly\n            .entrypoints\n            .iter()\n            .find(|ep| {\n                ep.paths.iter().any(|pattern| {\n                    glob_match(pattern.as_bytes(), path.as_os_str().as_encoded_bytes())\n                })\n            })\n            .ok_or_else(|| anyhow::anyhow!(\"No matching highlighting definition found\"))?\n    } else {\n        bail!(\"A language ID is required when reading from stdin\");\n    };\n\n    let mut color_map = Vec::new();\n    let mut unknown_kinds = Vec::new();\n    for hk in &assembly.highlight_kinds {","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/microsoft/edit/blob/826b4c097b6f14ba0a846dc56f2f0223a3aaf73a/crates/lsh-bin/src/main.rs#L100-L136","documentation":"After assembling all highlighting definitions, run_render looks up an entrypoint whose name (underscores normalized to dashes) equals the given language ID. If no loaded .lsh definition declares that language, it errors with the unmatched language quoted.","triggerScenarios":"Calling lsh --language <id> (or passing language=Some(id) into run_render) where no entrypoint in the assembled generator has a matching name — typo, wrong case, or the definition file was never loaded.","commonSituations":"Typos like `--language rust-lang` when the entrypoint is `rust`; expecting built-in languages without supplying the .lsh definitions; definitions loaded from a directory that excludes the needed file.","solutions":["Check the exact entrypoint name in your .lsh files (underscores in names become dashes on the CLI) and retry with the correct ID.","Ensure the .lsh file defining that language is included in the input paths passed to lsh.","List available entrypoints (e.g. by inspecting the loaded definitions) to see valid language IDs."],"exampleFix":"// before\nlsh --language rs main.rs\n// after\nlsh --language rust main.rs","handlingStrategy":"fallback","validationCode":"const KNOWN_LANGS: &[&str] = &[\"rust\", \"c\", \"javascript\"]; // from your .lsh entrypoints\nlet lang = \"rs\";\nif !KNOWN_LANGS.contains(&lang) { eprintln!(\"unknown language {lang}\"); }","typeGuard":null,"tryCatchPattern":"// run and surface the language error with available options\nmatch status {\n    Err(_) if stderr_contains(\"No highlighting definition found for language\") =>\n        eprintln!(\"try: lsh --language <one of: rust, c, ...>\"),\n    s => s?,\n}","preventionTips":["Keep a canonical language-ID table shared between your tooling and .lsh entrypoint names.","Remember underscores in entrypoint names become dashes on the CLI.","Regenerate/refresh the list of valid IDs whenever .lsh definitions change."],"tags":["cli","language-id","lookup-failed"],"backgroundTag":"resource-not-found","analyzedSha":"826b4c097b6f14ba0a846dc56f2f0223a3aaf73a","analyzedAt":"2026-09-06T13:30:05.543Z","contentChangedAt":"2026-09-06T13:30:05.543Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}