{"record":{"id":"96ca7252b7a1af23","repo":"helix-editor/helix","slug":"error-restarting-language-servers","errorCode":null,"errorMessage":"Error restarting language servers: {}","messagePattern":"Error restarting language servers: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"helix-term/src/commands/typed.rs","lineNumber":1880,"sourceCode":"                    language_servers\n                        .iter()\n                        .any(|restarted_ls| restarted_ls == &ls.name)\n                }) =>\n            {\n                Some(doc.id())\n            }\n            _ => None,\n        })\n        .collect();\n\n    for document_id in document_ids_to_refresh {\n        cx.editor.refresh_language_servers(document_id);\n    }\n\n    if errors.is_empty() {\n        Ok(())\n    } else {\n        Err(anyhow::anyhow!(\n            \"Error restarting language servers: {}\",\n            errors.join(\", \")\n        ))\n    }\n}\n\nfn lsp_stop(cx: &mut compositor::Context, args: Args, event: PromptEvent) -> anyhow::Result<()> {\n    if event != PromptEvent::Validate {\n        return Ok(());\n    }\n    let doc = doc!(cx.editor);\n\n    let language_servers: Vec<_> = doc\n        .language_servers()\n        .map(|ls| ls.name().to_string())\n        .collect();\n    let language_servers = if args.is_empty() {\n        language_servers","sourceCodeStart":1862,"sourceCodeEnd":1898,"githubUrl":"https://github.com/helix-editor/helix/blob/079a789e8cb08ead67f19e1971a1b7438b37354b/helix-term/src/commands/typed.rs#L1862-L1898","documentation":"`: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.","triggerScenarios":"`: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.","commonSituations":"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.","solutions":["Run `hx --health <lang>` — it shows the configured server command and whether it can be resolved.","Fix the [language-server] config or install the missing binary, then run `:lsp-restart` again.","Inspect the per-server details in ~/.local/state/helix/helix.log (or -v logging) if the joined message is not specific enough."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// preflight: does the configured server resolve?\nif which::which(&lang_server_config.command).is_err() {\n    // fix languages.toml / PATH before :lsp-restart\n}","typeGuard":null,"tryCatchPattern":"// treat as non-fatal: the command already aggregates per-server errors\nif let Err(err) = typed_lsp_restart(cx) {\n    cx.editor.set_error(err.to_string()); // log details, fix health, then retry once\n}","preventionTips":["Run `hx --health <lang>` after editing languages.toml or upgrading toolchains.","Prefer absolute paths for server binaries in pinned environments."],"tags":["lsp","restart","environment","config"],"backgroundTag":null,"analyzedSha":"079a789e8cb08ead67f19e1971a1b7438b37354b","analyzedAt":"2026-08-16T09:09:59.668Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}