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.
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@916fc2b8cb (2026-08-20).
Data as JSON: /api/errors/30424ae412dad049.
Report an issue: GitHub.
Appendix: source
Thrown at crates/settings_content/src/project.rs:366
/// Rules for rendering LSP semantic tokens.
pub semantic_token_rules: Option<SemanticTokenRules>,
}
#[with_fallible_options]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema, MergeFrom)]
pub struct LspNotificationSettingsContent {
/// Timeout in milliseconds for automatically dismissing language server notifications.
/// 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_to_string(file_path).with_context(|| {
anyhow::anyhow!(
"Could not read semantic token rules from {}",
file_path.display()
)
})?;
Self::parse(&rules_content).with_context(|| {
anyhow::anyhow!(
"Failed to parse semantic token rules from {}",
file_path.display()
)View on GitHub (pinned to 916fc2b8cb)