zed-industries/zed · error

command {command} is not advertised by the language server

Error message

command {command} is not advertised by the language server

What it means

Validation guard in execute_command: the server was found, but its executeCommandProvider capability does not list the requested command. The server itself declares which commands it supports; sending an unadvertised command would be rejected server-side, so it is refused locally before any request.

Source

Thrown at crates/project/src/lsp_store.rs:6663

                let response = request.await?;
                response
                    .result
                    .map(|result| serde_json::from_str(&result))
                    .transpose()
                    .context("deserializing executeCommand result")
            })
        } else if self.mode.is_local() {
            let Some(server) = self.language_server_for_id(server_id) else {
                return Task::ready(Err(anyhow!("language server {server_id} not found")));
            };
            let available_commands = server
                .capabilities()
                .execute_command_provider
                .as_ref()
                .map(|options| options.commands.clone())
                .unwrap_or_default();
            if !available_commands.contains(&command) {
                return Task::ready(Err(anyhow!(
                    "command {command} is not advertised by the language server"
                )));
            }
            let request_timeout = ProjectSettings::get_global(cx)
                .global_lsp_settings
                .get_request_timeout();
            cx.background_spawn(async move {
                server
                    .request::<lsp::request::ExecuteCommand>(
                        lsp::ExecuteCommandParams {
                            command,
                            arguments,
                            ..lsp::ExecuteCommandParams::default()
                        },
                        request_timeout,
                    )
                    .await
                    .into_response()

View on GitHub (pinned to 9d272b0363)

Solutions

  1. Check the command name for typos or version differences; the server's advertised commands may have changed between versions
  2. Query server.capabilities().execute_command_provider to enumerate valid commands before invoking
  3. If the server genuinely supports it but omits it from capabilities, allow-list the command as a workaround
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/project/src/lsp_store.rs:6663 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@9d272b0363 (2026-09-12). Data as JSON: /api/errors/f5e23d9bb423d760. Report an issue: GitHub.