{"record":{"id":"26c578f645acb68a","repo":"zed-industries/zed","slug":"failed-to-parse-rust-semantic-token-rules-json","errorCode":null,"errorMessage":"failed to parse rust semantic_token_rules.json","messagePattern":"failed to parse rust semantic_token_rules\\.json","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/languages/src/rust.rs","lineNumber":43,"sourceCode":"    borrow::Cow,\n    path::{Path, PathBuf},\n    sync::{Arc, LazyLock},\n};\nuse task::{TaskTemplate, TaskTemplates, TaskVariables, VariableName};\nuse util::command::{Stdio, new_command};\nuse util::fs::{make_file_executable, remove_matching};\nuse util::merge_json_value_into;\nuse util::rel_path::RelPath;\nuse util::{ResultExt, maybe};\n\nuse crate::language_settings::LanguageSettings;\n\npub(crate) fn semantic_token_rules() -> SemanticTokenRules {\n    let content = grammars::get_file(\"rust/semantic_token_rules.json\")\n        .expect(\"missing rust/semantic_token_rules.json\");\n    let json = std::str::from_utf8(&content.data).expect(\"invalid utf-8 in semantic_token_rules\");\n    settings::parse_json_with_comments::<SemanticTokenRules>(json)\n        .expect(\"failed to parse rust semantic_token_rules.json\")\n}\n\npub struct RustLspAdapter;\n\n#[cfg(target_os = \"macos\")]\nimpl RustLspAdapter {\n    const GITHUB_ASSET_KIND: AssetKind = AssetKind::Gz;\n    const ARCH_SERVER_NAME: &str = \"apple-darwin\";\n}\n\n#[cfg(target_os = \"linux\")]\nimpl RustLspAdapter {\n    const GITHUB_ASSET_KIND: AssetKind = AssetKind::Gz;\n    const ARCH_SERVER_NAME: &str = \"unknown-linux\";\n}\n\n#[cfg(target_os = \"freebsd\")]\nimpl RustLspAdapter {","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/languages/src/rust.rs#L25-L61","documentation":"Panics when the Rust rules JSONC fails to deserialize into SemanticTokenRules. File and type ship in lockstep, so this signals schema drift between the vendored JSON and the Rust struct (renamed/removed fields), surfacing the first time Rust semantic token rules are needed.","triggerScenarios":"Thrown at crates/languages/src/rust.rs:43 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Write a unit test parsing rust/semantic_token_rules.json into SemanticTokenRules to expose the serde error","Fix whichever side drifted (JSON file or struct fields)","Fall back to default rules with a warning instead of unwrapping"],"exampleFix":null,"handlingStrategy":"fallback","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-14T05:17:10.506Z"}