zed-industries/zed · error

missing go/semantic_token_rules.json

Error message

missing go/semantic_token_rules.json

What it means

Panics because grammars::get_file("go/semantic_token_rules.json") returned None: the Go semantic-token rules asset was not compiled into the binary. This is a build/packaging invariant — the file is vendored, so its absence means the grammars assets were not properly included, not that the user misconfigured anything.

Source

Thrown at crates/languages/src/go.rs:37

use std::{
    borrow::Cow,
    ffi::{OsStr, OsString},
    future::Future,
    ops::Range,
    path::{Path, PathBuf},
    process::Output,
    str,
    sync::{
        Arc, LazyLock,
        atomic::{AtomicBool, Ordering::SeqCst},
    },
};
use task::{TaskTemplate, TaskTemplates, TaskVariables, VariableName};
use util::{ResultExt, fs::remove_matching, maybe, merge_json_value_into};

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

fn server_binary_arguments() -> Vec<OsString> {
    vec!["-mode=stdio".into()]
}

#[derive(Copy, Clone)]
pub struct GoLspAdapter;

impl GoLspAdapter {
    const SERVER_NAME: LanguageServerName = LanguageServerName::new_static("gopls");
}

static VERSION_REGEX: LazyLock<Regex> =
    LazyLock::new(|| Regex::new(r"\d+\.\d+\.\d+").expect("Failed to create VERSION_REGEX"));

View on GitHub (pinned to f4178619ac)

Solutions

  1. Confirm go/semantic_token_rules.json exists in the grammars sources and is listed in embedded assets
  2. Rebuild so the asset is re-embedded
  3. Return default empty rules with a log warning instead of panicking on a missing asset
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/languages/src/go.rs:37 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/80570cf7d0b9bd7f. Report an issue: GitHub.