sinelaw/fresh · error

LSP server for ' ' is unavailable

Error message

LSP server for '${language}' is unavailable

What it means

In plugin_commands.rs, when a plugin issues an LSP request and auto-start is disabled, the code first tries try_spawn; if that fails it reports 'not running (auto_start disabled)', else it tries to fetch the server handle and forward the request. If the spawn succeeded path cannot produce a handle, or the handle lookup fails, this 'is unavailable' error string is returned to the plugin as the request error.

Solutions

  1. Install the language server binary for that language and ensure it is on PATH.
  2. Check LSP configuration for the language (command, args) in the editor settings.
  3. Enable auto_start for the language or manually start the LSP server before issuing plugin requests.
  4. Inspect LSP logs to see why try_spawn/get_handle failed (crash, bad args, permissions).

Example fix

// settings: language server missing
"lsp": { "python": { "command": "pyright-langserver" } }
// after installing: pip install pyright / npm i -g pyright, ensure `pyright-langserver --version` works
Defensive patterns

Strategy: fallback

Validate before calling

const cfg = lspConfig[language];
if (!cfg?.command) throw new Error(`no LSP config for ${language}`);
if (!checkCmd(cfg.command)) throw new Error(`${cfg.command} not on PATH`);

Try / catch

match lsp_request(lang, method, params) {
    Err(LspError::Unavailable(msg)) => { install_server(lang)?; lsp_request(lang, method, params)? }
    Err(e) => return Err(e),
    Ok(v) => Ok(v),
}

Prevention

When it happens

Trigger: A plugin sends an LSP request for a language whose server could not be spawned or whose handle cannot be retrieved: server binary missing from PATH, server crashed after spawn, or LSP configuration for that language is absent so no handle exists.

Common situations: Running the editor on a machine without the language server installed (e.g. rust-analyzer not on PATH); the LSP server executable failing to launch; language misconfigured in LSP settings; server exited due to bad initialization options.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


AI-assisted analysis of sinelaw/fresh@67894ca546 (2026-09-13). Data as JSON: /api/errors/2b34108f8f0c560a. Report an issue: GitHub.

Appendix: source

Thrown at crates/fresh-editor/src/app/plugin_commands.rs:2845

        request_id: u64,
    ) {
        tracing::debug!(
            "Plugin LSP request {} for language '{}': method={}",
            request_id,
            language,
            method
        );
        let __active_id = self.active_window;
        let error = if let Some(lsp) = self.windows.get_mut(&__active_id).map(|w| &mut w.lsp) {
            // Respect auto_start setting for plugin requests
            use crate::services::lsp::manager::LspSpawnResult;
            if lsp.try_spawn(&language, None) != LspSpawnResult::Spawned {
                Some(format!(
                    "LSP server for '{}' is not running (auto_start disabled)",
                    language
                ))
            } else if let Some(handle) = lsp.get_handle_mut(&language) {
                handle.send_plugin_request(request_id, method, params).err()
            } else {
                Some(format!("LSP server for '{}' is unavailable", language))
            }
        } else {
            Some("LSP manager not initialized".to_string())
        };
        if let Some(err_msg) = error {
            self.plugin_manager
                .read()
                .unwrap()
                .reject_callback(fresh_core::api::JsCallbackId::from(request_id), err_msg);
        }
    }

    // ==================== Clipboard Commands ====================

    /// Handle SetClipboard command
    pub(super) fn handle_set_clipboard(&mut self, text: String) {

View on GitHub (pinned to 67894ca546)