{"record":{"id":"d3cf48af57b2174c","repo":"zed-industries/zed","slug":"failed-to-parse-go-semantic-token-rules-json","errorCode":null,"errorMessage":"failed to parse go semantic_token_rules.json","messagePattern":"failed to parse go semantic_token_rules\\.json","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/languages/src/go.rs","lineNumber":40,"sourceCode":"    future::Future,\n    ops::Range,\n    path::{Path, PathBuf},\n    process::Output,\n    str,\n    sync::{\n        Arc, LazyLock,\n        atomic::{AtomicBool, Ordering::SeqCst},\n    },\n};\nuse task::{TaskTemplate, TaskTemplates, TaskVariables, VariableName};\nuse util::{ResultExt, fs::remove_matching, maybe, merge_json_value_into};\n\npub(crate) fn semantic_token_rules() -> SemanticTokenRules {\n    let content = grammars::get_file(\"go/semantic_token_rules.json\")\n        .expect(\"missing go/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 go semantic_token_rules.json\")\n}\n\nfn server_binary_arguments() -> Vec<OsString> {\n    vec![\"-mode=stdio\".into()]\n}\n\n#[derive(Copy, Clone)]\npub struct GoLspAdapter;\n\nimpl GoLspAdapter {\n    const SERVER_NAME: LanguageServerName = LanguageServerName::new_static(\"gopls\");\n}\n\nstatic VERSION_REGEX: LazyLock<Regex> =\n    LazyLock::new(|| Regex::new(r\"\\d+\\.\\d+\\.\\d+\").expect(\"Failed to create VERSION_REGEX\"));\n\nstatic GO_ESCAPE_SUBTEST_NAME_REGEX: LazyLock<Regex> = LazyLock::new(|| {\n    Regex::new(r#\"[.*+?^${}()|\\[\\]\\\\\"']\"#).expect(\"Failed to create GO_ESCAPE_SUBTEST_NAME_REGEX\")","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/languages/src/go.rs#L22-L58","documentation":"Panics when the Go rules JSONC text fails to deserialize into SemanticTokenRules. The file and the Rust type are vendored in lockstep, so a parse error means schema drift — the JSON's shape no longer matches SemanticTokenRules — introduced by an edit to either side.","triggerScenarios":"Thrown at crates/languages/src/go.rs:40 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reproduce deserialization in a unit test to expose the serde mismatch and fix the file or type","Add CI validation that parses every vendored semantic_token_rules.json against its target type","Fall back to default rules with a logged warning instead of panicking"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}