{"record":{"id":"ff6f223e6d94b8b2","repo":"rust-lang/rust","slug":"rust-analyzer-language-server-is-not-available-pl","errorCode":null,"errorMessage":"rust-analyzer Language Server is not available. Please, ensure its [proper installation](https://rust-analyzer.github.io/book/installation.html).","messagePattern":"rust-analyzer Language Server is not available\\. Please, ensure its \\[proper installation\\]\\(https://rust-analyzer\\.github\\.io/book/installation\\.html\\)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"src/tools/rust-analyzer/editors/code/src/bootstrap.ts","lineNumber":16,"sourceCode":"import * as vscode from \"vscode\";\nimport * as os from \"os\";\nimport type { Config } from \"./config\";\nimport { type Env, log, RUST_TOOLCHAIN_FILES, spawnAsync } from \"./util\";\nimport type { PersistentState } from \"./persistent_state\";\nimport { exec } from \"child_process\";\nimport { TextDecoder } from \"node:util\";\n\nexport async function bootstrap(\n    context: vscode.ExtensionContext,\n    config: Config,\n    state: PersistentState,\n): Promise<string> {\n    const path = await getServer(context, config, state);\n    if (!path) {\n        throw new Error(\n            \"rust-analyzer Language Server is not available. \" +\n                \"Please, ensure its [proper installation](https://rust-analyzer.github.io/book/installation.html).\",\n        );\n    }\n\n    log.info(\"Using server binary at\", path);\n\n    if (!isValidExecutable(path, config.serverExtraEnv)) {\n        throw new Error(\n            `Failed to execute ${path} --version.` +\n                (config.serverPath\n                    ? `\\`config.server.path\\` or \\`config.serverPath\\` has been set explicitly.\\\n            Consider removing this config or making a valid server binary available at that path.`\n                    : \"\"),\n        );\n    }\n\n    return path;","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/rust-lang/rust/blob/7088e4b63a9516ebfbfe2ab2d999cf01a528ac14/src/tools/rust-analyzer/editors/code/src/bootstrap.ts#L1-L34","documentation":"Thrown by bootstrap() in the rust-analyzer VS Code extension when getServer() returns undefined, meaning no rust-analyzer server binary could be resolved. getServer() tries, in order: an explicit path from config.serverPath or __RA_LSP_SERVER_DEBUG env, a rustup-managed rust-analyzer component declared in rust-toolchain.toml, the literal 'rust-analyzer' (only when releaseTag is null, i.e. dev builds), and finally the binary bundled inside the extension under server/. If none yield a path, the extension cannot start its language server.","triggerScenarios":"getServer() returns undefined at bootstrap.ts:14-15. This happens specifically when: (a) releaseTag is non-null (published extension), (b) no serverPath configured, (c) no rust-toolchain.toml with a rust-analyzer component in any workspace folder, and (d) the bundled server/rust-analyzer binary does not exist at the extension's server/ URI (fileExists returns false at line 92), which triggers the 'platform not supported' dialog at line 109 and returns undefined.","commonSituations":"Running the extension from source in a dev build on an unsupported platform; installing the extension on an architecture for which no prebuilt binary ships (e.g. some ARM or uncommon Linux distros); the bundled binary was deleted from the extension folder; or a corrupt extension install where the server/ directory is missing.","solutions":["Install rust-analyzer independently (rustup component add rust-analyzer) and ensure it is on PATH so the toolchain resolution path picks it up.","Set 'rust-analyzer.server.path' in VS Code settings to the absolute path of a working rust-analyzer binary.","Create a rust-toolchain.toml in the workspace root that lists 'rust-analyzer' in the components array, so getServer() resolves it via rustup which.","If building from source, run 'cargo xtask install --server' to produce a server binary, or set __RA_LSP_SERVER_DEBUG to point at it.","Reinstall the extension to restore the bundled server/ binary if it was deleted."],"exampleFix":"// before: no config, relying on missing bundled binary\n// after: set server path in settings.json\n{\n  \"rust-analyzer.server.path\": \"/usr/local/bin/rust-analyzer\"\n}","handlingStrategy":"validation","validationCode":"// Before calling bootstrap, pre-validate that a server can be resolved.\nimport * as vscode from 'vscode';\nimport { isValidExecutable } from './bootstrap';\n\nasync function ensureServerAvailable(config: Config): Promise<string | null> {\n  // Check explicit path\n  const explicit = process.env['__RA_LSP_SERVER_DEBUG'] ?? config.serverPath;\n  if (explicit) {\n    const expanded = explicit.startsWith('~/')\n      ? os.homedir() + explicit.slice(1) : explicit;\n    if (await isValidExecutable(expanded, config.serverExtraEnv)) return expanded;\n    return null;\n  }\n  // Check PATH for rust-analyzer\n  return null; // falls through to bundled logic\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always install rust-analyzer via rustup so the toolchain resolution path in getServer() finds it.","If using a non-standard binary location, set 'rust-analyzer.server.path' to an absolute path.","Add a 'rust-analyzer' component to rust-toolchain.toml in workspace roots for consistent team setups.","On unsupported platforms, build the server with 'cargo xtask install --server' before opening the project."],"tags":["rust-analyzer","vscode-extension","language-server","configuration","binary-resolution"],"backgroundTag":null,"analyzedSha":"7088e4b63a9516ebfbfe2ab2d999cf01a528ac14","analyzedAt":"2026-08-10T14:17:03.603Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}