zed-industries/zed · error
missing cpp/semantic_token_rules.json
Error message
missing cpp/semantic_token_rules.json
What it means
Panics because the embedded-file lookup grammars::get_file("cpp/semantic_token_rules.json") returned None: the JSONC rules file was not found in the compiled-in grammars assets. Since the file is vendored into the binary, this indicates the asset was not included at build time (packaging/extension build issue), not a runtime environment problem.
Source
Thrown at crates/languages/src/cpp.rs:5
use settings::SemanticTokenRules;
pub(crate) fn semantic_token_rules() -> SemanticTokenRules {
let content = grammars::get_file("cpp/semantic_token_rules.json")
.expect("missing cpp/semantic_token_rules.json");
let json = std::str::from_utf8(&content.data).expect("invalid utf-8 in semantic_token_rules");
settings::parse_json_with_comments::<SemanticTokenRules>(json)
.expect("failed to parse cpp semantic_token_rules.json")
}
#[cfg(test)]
mod tests {
use gpui::{AppContext as _, BorrowAppContext, TestAppContext};
use language::{AutoindentMode, Buffer};
use settings::SettingsStore;
use std::num::NonZeroU32;
use unindent::Unindent;
#[gpui::test]
async fn test_cpp_autoindent_switch_case(cx: &mut TestAppContext) {
cx.update(|cx| {
let test_settings = SettingsStore::test(cx);
cx.set_global(test_settings);View on GitHub (pinned to f4178619ac)
Solutions
- Verify cpp/semantic_token_rules.json is present in the grammars assets and included by the build
- Rebuild the extensions/grammars crate so assets are re-embedded
- Replace expect with a warning log returning default (empty) SemanticTokenRules so a missing asset degrades gracefully
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at crates/languages/src/cpp.rs:5 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/72d3c93d3671416e.
Report an issue: GitHub.