zed-industries/zed · error
incompatible grammar
Error message
incompatible grammar
What it means
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.
Source
Thrown at crates/language/src/language.rs:1450
}
impl PartialEq for Language {
fn eq(&self, other: &Self) -> bool {
self.id.eq(&other.id)
}
}
impl Eq for Language {}
impl Debug for Language {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Language")
.field("name", &self.config.name)
.finish()
}
}
pub(crate) fn parse_text(grammar: &Grammar, text: &Rope, old_tree: Option<Tree>) -> Tree {
with_parser(|parser| {
parser
.set_language(&grammar.ts_language)
.expect("incompatible grammar");
let mut chunks = text.chunks_in_range(0..text.len());
parser
.parse_with_options(
&mut move |offset, _| {
chunks.seek(offset);
chunks.next().unwrap_or("").as_bytes()
},
old_tree.as_ref(),
None,
)
.unwrap()
})
}
View on GitHub (pinned to 9d272b0363)
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/language/src/language.rs:1382 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@9d272b0363 (2026-08-20).
Data as JSON: /api/errors/49e74cf64279e53e.
Report an issue: GitHub.