zed-industries/zed · error

missing rust/semantic_token_rules.json

Error message

missing rust/semantic_token_rules.json

What it means

Panics because grammars::get_file("rust/semantic_token_rules.json") returned None: the Rust semantic-token rules asset was not found among the embedded grammar files. This is a build invariant — the vendored file missing from the binary indicates a packaging/build problem, not user input.

Source

Thrown at crates/languages/src/rust.rs:40

use std::future::Future;
use std::ops::Range;
use std::{
    borrow::Cow,
    path::{Path, PathBuf},
    sync::{Arc, LazyLock},
};
use task::{TaskTemplate, TaskTemplates, TaskVariables, VariableName};
use util::command::{Stdio, new_command};
use util::fs::{make_file_executable, remove_matching};
use util::merge_json_value_into;
use util::rel_path::RelPath;
use util::{ResultExt, maybe};

use crate::language_settings::LanguageSettings;

pub(crate) fn semantic_token_rules() -> SemanticTokenRules {
    let content = grammars::get_file("rust/semantic_token_rules.json")
        .expect("missing rust/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 rust semantic_token_rules.json")
}

pub struct RustLspAdapter;

#[cfg(target_os = "macos")]
impl RustLspAdapter {
    const GITHUB_ASSET_KIND: AssetKind = AssetKind::Gz;
    const ARCH_SERVER_NAME: &str = "apple-darwin";
}

#[cfg(target_os = "linux")]
impl RustLspAdapter {
    const GITHUB_ASSET_KIND: AssetKind = AssetKind::Gz;
    const ARCH_SERVER_NAME: &str = "unknown-linux";
}

View on GitHub (pinned to 9d272b0363)

Solutions

  1. Ensure rust/semantic_token_rules.json is in the embedded assets and rebuild the grammars crate
  2. Add a test enumerating expected language asset files
  3. Return default empty rules with a logged warning instead of panicking
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/languages/src/rust.rs:40 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/edd52adc6875b8af. Report an issue: GitHub.