helix-editor/helix · error · anyhow::Error

Error restarting language servers: {}

Error message

Error restarting language servers: {}

What it means

`:lsp-restart` restarts the language servers of the current document's language, collecting per-server errors while refreshing documents. If any restart failed, the collected messages are joined with ', ' and returned as one anyhow error, 'Error restarting language servers: ...'. Typical inner errors are a server binary missing from PATH or a malformed languages.toml language-server entry.

Source

Thrown at helix-term/src/commands/typed.rs:1880

                    language_servers
                        .iter()
                        .any(|restarted_ls| restarted_ls == &ls.name)
                }) =>
            {
                Some(doc.id())
            }
            _ => None,
        })
        .collect();

    for document_id in document_ids_to_refresh {
        cx.editor.refresh_language_servers(document_id);
    }

    if errors.is_empty() {
        Ok(())
    } else {
        Err(anyhow::anyhow!(
            "Error restarting language servers: {}",
            errors.join(", ")
        ))
    }
}

fn lsp_stop(cx: &mut compositor::Context, args: Args, event: PromptEvent) -> anyhow::Result<()> {
    if event != PromptEvent::Validate {
        return Ok(());
    }
    let doc = doc!(cx.editor);

    let language_servers: Vec<_> = doc
        .language_servers()
        .map(|ls| ls.name().to_string())
        .collect();
    let language_servers = if args.is_empty() {
        language_servers

View on GitHub (pinned to 079a789e8c)

Solutions

  1. Run `hx --health <lang>` — it shows the configured server command and whether it can be resolved.
  2. Fix the [language-server] config or install the missing binary, then run `:lsp-restart` again.
  3. Inspect the per-server details in ~/.local/state/helix/helix.log (or -v logging) if the joined message is not specific enough.
Defensive patterns

Strategy: try-catch

Validate before calling

// preflight: does the configured server resolve?
if which::which(&lang_server_config.command).is_err() {
    // fix languages.toml / PATH before :lsp-restart
}

Try / catch

// treat as non-fatal: the command already aggregates per-server errors
if let Err(err) = typed_lsp_restart(cx) {
    cx.editor.set_error(err.to_string()); // log details, fix health, then retry once
}

Prevention

When it happens

Trigger: `:lsp-restart` when the language-server binary was removed/renamed (e.g. a toolchain upgrade), the [language-server] command/args in languages.toml are wrong, or the server process exits during startup.

Common situations: Upgrades renaming server binaries; PATH differences when helix is launched from a GUI; config edits that break the server entry; servers that crash on certain project files.

Related errors


AI-assisted analysis of helix-editor/helix@079a789e8c (2026-08-16). Data as JSON: /api/errors/96ca7252b7a1af23. Report an issue: GitHub.