Kuberwastaken/claurst · error · anyhow::Error
No LSP server configured for
Error message
No LSP server configured for '{}' What it means
Thrown in `LspManager::hover` when `server_name_for_file(file_path)` returns `None` — no registered LSP server config claims the file's language/extension. The manager refuses to start any server because it does not know which one would handle this file.
Solutions
- Register a server config covering the file's language via seed_from_config / register_server before calling hover.
- Check settings so the file's extension is listed in the appropriate server's languages/extensions.
- Skip LSP features gracefully for unconfigured file types instead of propagating the error.
- Verify server_name_for_file's matching logic against the actual file name/extension.
Example fix
// before: hover on any file, erroring on unconfigured types
let hover = manager.hover(path, root, line, col).await?;
// after: only when a server is configured for the type
if manager.server_name_for_file(path).is_some() {
let hover = manager.hover(path, root, line, col).await?;
} Defensive patterns
Strategy: validation
Validate before calling
// pre-check before hover
if manager.server_name_for_file(path).is_none() {
return Ok(None); // no server configured for this file type
} Type guard
fn has_lsp_server(manager: &LspManager, path: &str) -> bool {
manager.server_name_for_file(path).is_some()
} Try / catch
let hover = manager.hover(path, root, line, col).await
.or_else(|e| {
if e.to_string().starts_with("No LSP server configured") { Ok(None) } else { Err(e) }
})?; Prevention
- Seed the manager with all needed server configs at startup (seed_from_config).
- Keep the extensions->server mapping in settings in sync with the file types your tool opens.
- Return empty/degraded results for unconfigured languages instead of erroring.
When it happens
Trigger: hover(file_path, root_dir, line, character) called with a file extension (or language id) not covered by any registered LspServerConfig (see register_server / seed_from_config).
Common situations: Requesting hover on a file type like .txt, .json, or a new extension the user hasn't configured; LSP servers section missing from settings; language mapping typo in config (e.g. `rs` vs `rust` extensions).
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- Failed to start LSP server
- LSP server stdin not available
- LSP server stdout not available
- LSP client already shut down
- LSP request ' ' timed out (server: )
AI-assisted analysis of Kuberwastaken/claurst@b0637c97ec (2026-09-10).
Data as JSON: /api/errors/883807c39658da23.
Report an issue: GitHub.
Appendix: source
Thrown at src-rust/crates/core/src/lsp.rs:1110
if !self.configs.iter().any(|c| c.name == cfg.name) {
self.register_server(cfg.clone());
}
}
}
/// Get hover information for `file_path` at the given 1-based position.
pub async fn hover(
&mut self,
file_path: &str,
root_dir: &Path,
line: u32,
character: u32,
) -> anyhow::Result<Option<String>> {
let uri = path_to_uri(file_path);
let server_name = self
.server_name_for_file(file_path)
.ok_or_else(|| {
anyhow::anyhow!("No LSP server configured for '{}'", file_path)
})?
.to_string();
self.ensure_started(file_path, root_dir).await?;
let client = self
.clients
.get(&server_name)
.ok_or_else(|| anyhow::anyhow!("LSP server '{}' not running", server_name))?;
client.hover(&uri, line, character).await
}
/// Get definition locations for `file_path` at the given 1-based position.
pub async fn definition(
&mut self,
file_path: &str,
root_dir: &Path,
line: u32,
character: u32,
) -> anyhow::Result<Vec<String>> {
View on GitHub (pinned to b0637c97ec)