zed-industries/zed · error · anyhow::Error
Could not read semantic token rules from {}
Error message
Could not read semantic token rules from {} What it means
IO context in SemanticTokenRules::load(): std::fs::read of semantic_token_rules.json failed (missing file, permissions, or other IO error). The path is embedded so the user knows which file could not be read.
Source
Thrown at crates/settings_content/src/project.rs:285
/// Set to 0 to disable auto-dismiss.
///
/// Default: 5000
pub dismiss_timeout_ms: Option<u64>,
}
/// Custom rules for rendering LSP semantic tokens.
#[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq, JsonSchema)]
#[serde(transparent)]
pub struct SemanticTokenRules {
pub rules: Vec<SemanticTokenRule>,
}
impl SemanticTokenRules {
pub const FILE_NAME: &'static str = "semantic_token_rules.json";
pub fn load(file_path: &Path) -> anyhow::Result<Self> {
let rules_content = std::fs::read(file_path).with_context(|| {
anyhow::anyhow!(
"Could not read semantic token rules from {}",
file_path.display()
)
})?;
serde_json_lenient::from_slice::<SemanticTokenRules>(&rules_content).with_context(|| {
anyhow::anyhow!(
"Failed to parse semantic token rules from {}",
file_path.display()
)
})
}
}
impl crate::merge_from::MergeFrom for SemanticTokenRules {
fn merge_from(&mut self, other: &Self) {
self.rules.splice(0..0, other.rules.iter().cloned());
}View on GitHub (pinned to f4178619ac)
Solutions
- Ensure semantic_token_rules.json exists and is readable
- Fix the file path configured for custom semantic token rules
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at crates/settings_content/src/project.rs:285 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/30424ae412dad049.
Report an issue: GitHub.