zed-industries/zed · error · anyhow::Error

cannot expand Emmet abbreviations with the {} server

Error message

cannot expand Emmet abbreviations with the {} server

What it means

Precondition check (anyhow::ensure!) in to_lsp for the ExpandAbbreviation action: it fires when the request is routed to a language server whose name is not the Emmet server. Only the dedicated Emmet language server supports abbreviation expansion, so dispatching to any other server (e.g. a regular LSP like typescript-language-server) fails here with the offending server's name interpolated into the message.

Source

Thrown at crates/project/src/lsp_store/emmet_ext.rs:95

        "Expand Emmet abbreviation"
    }

    fn check_capabilities(&self, _: AdapterServerCapabilities) -> bool {
        true
    }

    fn language_server_to_query(&self) -> LanguageServerToQuery {
        LanguageServerToQuery::Other(self.server_id)
    }

    fn to_lsp(
        &self,
        _: &Path,
        _: &Buffer,
        server: &Arc<LanguageServer>,
        _: &App,
    ) -> Result<ExpandAbbreviationParams> {
        anyhow::ensure!(
            server.name() == EMMET_SERVER_NAME,
            "cannot expand Emmet abbreviations with the {} server",
            server.name()
        );
        let multiline = self.text.as_ref().is_some_and(|text| text.len() > 1);
        Ok(ExpandAbbreviationParams {
            abbreviation: self.abbreviation.clone(),
            language: self.language.clone(),
            options: ExpandAbbreviationOptions {
                text: self.text.clone(),
                options: EmmetOutputOptions {
                    indent: self.indent.clone(),
                    base_indent: self.base_indent.clone(),
                    comment_enabled: self.comment_filter.then_some(true),
                    bem_enabled: self.bem_filter.then_some(true),
                    inline_break: multiline.then_some(1),
                },
            },

View on GitHub (pinned to 5a9b9558db)

Solutions

  1. Ensure the Emmet extension/server is installed and running so the action is dispatched to a server named 'emmet-language-server'
  2. Check language server configuration to make sure Emmet is enabled for the relevant file type and other servers don't intercept the expansion request
  3. Verify the server name returned by server.name() matches the expected EMMET_SERVER_NAME constant
Defensive patterns

Strategy: validation

When it happens

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

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@5a9b9558db (2026-09-05). Data as JSON: /api/errors/fd458193239e69c3. Report an issue: GitHub.