{"record":{"id":"2b34108f8f0c560a","repo":"sinelaw/fresh","slug":"lsp-server-for-language-is-unavailable","errorCode":null,"errorMessage":"LSP server for '${language}' is unavailable","messagePattern":"LSP server for '(.+?)' is unavailable","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/fresh-editor/src/app/plugin_commands.rs","lineNumber":2845,"sourceCode":"        request_id: u64,\n    ) {\n        tracing::debug!(\n            \"Plugin LSP request {} for language '{}': method={}\",\n            request_id,\n            language,\n            method\n        );\n        let __active_id = self.active_window;\n        let error = if let Some(lsp) = self.windows.get_mut(&__active_id).map(|w| &mut w.lsp) {\n            // Respect auto_start setting for plugin requests\n            use crate::services::lsp::manager::LspSpawnResult;\n            if lsp.try_spawn(&language, None) != LspSpawnResult::Spawned {\n                Some(format!(\n                    \"LSP server for '{}' is not running (auto_start disabled)\",\n                    language\n                ))\n            } else if let Some(handle) = lsp.get_handle_mut(&language) {\n                handle.send_plugin_request(request_id, method, params).err()\n            } else {\n                Some(format!(\"LSP server for '{}' is unavailable\", language))\n            }\n        } else {\n            Some(\"LSP manager not initialized\".to_string())\n        };\n        if let Some(err_msg) = error {\n            self.plugin_manager\n                .read()\n                .unwrap()\n                .reject_callback(fresh_core::api::JsCallbackId::from(request_id), err_msg);\n        }\n    }\n\n    // ==================== Clipboard Commands ====================\n\n    /// Handle SetClipboard command\n    pub(super) fn handle_set_clipboard(&mut self, text: String) {","sourceCodeStart":2827,"sourceCodeEnd":2863,"githubUrl":"https://github.com/sinelaw/fresh/blob/67894ca5463dbd7a89bb31add4627c27d6b79d83/crates/fresh-editor/src/app/plugin_commands.rs#L2827-L2863","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Install the language server binary for that language and ensure it is on PATH.","Check LSP configuration for the language (command, args) in the editor settings.","Enable auto_start for the language or manually start the LSP server before issuing plugin requests.","Inspect LSP logs to see why try_spawn/get_handle failed (crash, bad args, permissions)."],"exampleFix":"// settings: language server missing\n\"lsp\": { \"python\": { \"command\": \"pyright-langserver\" } }\n// after installing: pip install pyright / npm i -g pyright, ensure `pyright-langserver --version` works","handlingStrategy":"fallback","validationCode":"const cfg = lspConfig[language];\nif (!cfg?.command) throw new Error(`no LSP config for ${language}`);\nif (!checkCmd(cfg.command)) throw new Error(`${cfg.command} not on PATH`);","typeGuard":null,"tryCatchPattern":"match lsp_request(lang, method, params) {\n    Err(LspError::Unavailable(msg)) => { install_server(lang)?; lsp_request(lang, method, params)? }\n    Err(e) => return Err(e),\n    Ok(v) => Ok(v),\n}","preventionTips":["Install and version-check all language servers during editor setup.","Enable auto_start for languages used by plugins.","Monitor LSP process health and restart on exit.","Log try_spawn failures with the underlying spawn error."],"tags":["lsp","language-server","plugin-api"],"backgroundTag":"missing-dependency","analyzedSha":"67894ca5463dbd7a89bb31add4627c27d6b79d83","analyzedAt":"2026-09-13T15:04:03.701Z","contentChangedAt":"2026-09-13T15:04:03.701Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}