{"record":{"id":"c7d86848e82b2ca5","repo":"zed-industries/zed","slug":"resolving-a-native-parseable-language-cannot-fail","errorCode":null,"errorMessage":"resolving a native parseable language cannot fail","messagePattern":"resolving a native parseable language cannot fail","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/language_core/src/grammar.rs","lineNumber":341,"sourceCode":"            .ok()\n            .and_then(|ts_language| Query::new(&ts_language, \"(ERROR) @error\").ok());\n        Self {\n            id: GrammarId::new(),\n            highlights_config: None,\n            brackets_config: None,\n            outline_config: None,\n            text_object_config: None,\n            indents_config: None,\n            injection_config: None,\n            override_config: None,\n            redactions_config: None,\n            runnable_config: None,\n            error_query,\n            debug_variables_config: None,\n            #[cfg(not(target_family = \"wasm\"))]\n            ts_language: parseable_language\n                .resolve()\n                .expect(\"resolving a native parseable language cannot fail\"),\n            #[cfg(target_family = \"wasm\")]\n            parseable_language,\n            highlight_map: Default::default(),\n        }\n    }\n\n    /// A parseable [`tree_sitter::Language`] valid on the calling thread.\n    ///\n    /// See [`ParseableLanguage`] for why this is a resolution rather than a\n    /// field access on WebAssembly.\n    pub fn parseable_language(&self) -> Result<tree_sitter::Language> {\n        #[cfg(not(target_family = \"wasm\"))]\n        {\n            Ok(self.ts_language.clone())\n        }\n        #[cfg(target_family = \"wasm\")]\n        {\n            self.parseable_language.resolve()","sourceCodeStart":323,"sourceCodeEnd":359,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/language_core/src/grammar.rs#L323-L359","documentation":"Asserts that resolving a native (non-WASM) grammar's language always succeeds — resolution here is just returning the statically linked tree-sitter language, which cannot fail by construction. The unwrap documents an invariant of native grammars; if it ever fires, the native grammar registry returned a grammar whose native handle is absent, i.e., an internal registration bug rather than bad input.","triggerScenarios":"Thrown at crates/language_core/src/grammar.rs:339 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Audit native grammar registration to ensure every native Grammar carries its tree-sitter language","Return a Result from resolution and surface a descriptive error listing the grammar name","Add a registration test that resolves every native grammar once"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9d272b036335401f339d024ea94968fd51016c40","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}