xai-org/grok-build · error

No LSP servers are running.

Error message

No LSP servers are running.

What it means

workspace_symbol needs at least one live LSP client to query. The manager checks self.clients.is_empty() before iterating and returns this message when no language servers are running at all. Unlike error 761 (wrong file type), this means the manager has zero servers, usually because none were started or all failed/exited.

Source

Thrown at crates/codegen/xai-grok-tools/src/implementations/lsp/manager.rs:579

            LspOperation::DocumentSymbol => {
                let Some(ref file_path) = input.file_path else {
                    return err("Required: file_path (string).".into());
                };
                let path = PathBuf::from(file_path);
                let Some(client) = self.client_for_file_mut(&path) else {
                    return err(format!("No LSP server configured for {}", path.display()));
                };
                client
                    .document_symbols(&path)
                    .await
                    .map(|s| format_symbols(&s))
            }
            LspOperation::WorkspaceSymbol => {
                let Some(ref query) = input.query else {
                    return err("Required: query (string).".into());
                };
                if self.clients.is_empty() {
                    return err("No LSP servers are running.".into());
                }
                let mut all_symbols = Vec::new();
                let mut last_err = None;
                for client in self.clients.values_mut() {
                    match client.workspace_symbols(query).await {
                        Ok(symbols) => all_symbols.extend(symbols),
                        Err(e) => {
                            last_err = Some(e);
                        }
                    }
                }
                if all_symbols.is_empty() {
                    match last_err {
                        Some(e) => Err(e),
                        None => Ok(format_symbols(&[])),
                    }
                } else {
                    Ok(format_symbols(&all_symbols))

View on GitHub (pinned to bc7f02eddd)

Solutions

  1. Open or touch a file of a supported language first so the manager starts an LSP client, then retry workspace_symbol.
  2. Check language-server installation/startup logs; fix spawn failures (missing binary, bad command path).
  3. Ensure the manager is configured with at least one language server before accepting workspace queries.
  4. Add a readiness check (clients non-empty) in caller code before issuing workspace-wide requests.

Example fix

// before — no servers started
await manager.dispatch({ operation: "workspace_symbol", query: "main" })
// after — start a server first
await manager.start_client("src/main.rs");
await manager.dispatch({ operation: "workspace_symbol", query: "main" })
Defensive patterns

Strategy: try-catch

Validate before calling

async function ensureClientsReady(manager, sampleFile) {
  if (!(await manager.clientCount() > 0)) {
    await manager.start_client(sampleFile); // spin up at least one server
  }
}

Try / catch

try {
  symbols = await lspTool({ operation: 'workspace_symbol', query: q });
} catch (e) {
  if (String(e).includes('No LSP servers are running')) {
    await startDefaultLanguageServers();
    symbols = await lspTool({ operation: 'workspace_symbol', query: q });
  } else { throw e; }
}

Prevention

When it happens

Trigger: Calling workspace_symbol before any LSP server has been spawned; all clients exited after crashes; the manager was constructed with an empty client set (no languages configured).

Common situations: Calling the tool before opening/initializing any files (lazy server start means no clients yet); language servers failed to install or launch; workspace initialized without server configuration.

Related errors


AI-assisted analysis of xai-org/grok-build@bc7f02eddd (2026-08-31). Data as JSON: /api/errors/65291e3ab1a5d229. Report an issue: GitHub.