{"record":{"id":"49e74cf64279e53e","repo":"zed-industries/zed","slug":"incompatible-grammar","errorCode":null,"errorMessage":"incompatible grammar","messagePattern":"incompatible grammar","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/language/src/language.rs","lineNumber":1450,"sourceCode":"}\n\nimpl PartialEq for Language {\n    fn eq(&self, other: &Self) -> bool {\n        self.id.eq(&other.id)\n    }\n}\n\nimpl Eq for Language {}\n\nimpl Debug for Language {\n    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n        f.debug_struct(\"Language\")\n            .field(\"name\", &self.config.name)\n            .finish()\n    }\n}\n\npub(crate) fn parse_text(grammar: &Grammar, text: &Rope, old_tree: Option<Tree>) -> Tree {\n    with_parser(|parser| {\n        parser\n            .set_language(&grammar.ts_language)\n            .expect(\"incompatible grammar\");\n        let mut chunks = text.chunks_in_range(0..text.len());\n        parser\n            .parse_with_options(\n                &mut move |offset, _| {\n                    chunks.seek(offset);\n                    chunks.next().unwrap_or(\"\").as_bytes()\n                },\n                old_tree.as_ref(),\n                None,\n            )\n            .unwrap()\n    })\n}\n","sourceCodeStart":1432,"sourceCodeEnd":1468,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/language/src/language.rs#L1432-L1468","documentation":"Panics when parser.set_language fails while binding a tree-sitter grammar's language to the pooled parser in parse_text. The 'incompatible grammar' error fires when the grammar's ABI version is incompatible with the linked tree-sitter runtime, or the language node is corrupt — typically after upgrading tree-sitter without rebuilding vendored WASM/native grammars.","triggerScenarios":"Thrown at crates/language/src/language.rs:1382 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rebuild/re-vendor the grammars so their tree-sitter ABI matches the runtime version","Check the LANGUAGE_VERSION/LANGUAGE_VERSION_MINIMUM reported by tree-sitter and pin compatible crate versions","Propagate the error from parse_text (return Result) so the language can be disabled instead of crashing parsing"],"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"}