rust-lang/rust · critical · Error

rust-analyzer Language Server is not available. Please, ensu

Error message

rust-analyzer Language Server is not available. Please, ensure its [proper installation](https://rust-analyzer.github.io/book/installation.html).

What it means

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.

Source

Thrown at src/tools/rust-analyzer/editors/code/src/bootstrap.ts:16

import * as vscode from "vscode";
import * as os from "os";
import type { Config } from "./config";
import { type Env, log, RUST_TOOLCHAIN_FILES, spawnAsync } from "./util";
import type { PersistentState } from "./persistent_state";
import { exec } from "child_process";
import { TextDecoder } from "node:util";

export async function bootstrap(
    context: vscode.ExtensionContext,
    config: Config,
    state: PersistentState,
): Promise<string> {
    const path = await getServer(context, config, state);
    if (!path) {
        throw new Error(
            "rust-analyzer Language Server is not available. " +
                "Please, ensure its [proper installation](https://rust-analyzer.github.io/book/installation.html).",
        );
    }

    log.info("Using server binary at", path);

    if (!isValidExecutable(path, config.serverExtraEnv)) {
        throw new Error(
            `Failed to execute ${path} --version.` +
                (config.serverPath
                    ? `\`config.server.path\` or \`config.serverPath\` has been set explicitly.\
            Consider removing this config or making a valid server binary available at that path.`
                    : ""),
        );
    }

    return path;

View on GitHub (pinned to 7088e4b63a)

Solutions

  1. Install rust-analyzer independently (rustup component add rust-analyzer) and ensure it is on PATH so the toolchain resolution path picks it up.
  2. Set 'rust-analyzer.server.path' in VS Code settings to the absolute path of a working rust-analyzer binary.
  3. Create a rust-toolchain.toml in the workspace root that lists 'rust-analyzer' in the components array, so getServer() resolves it via rustup which.
  4. If building from source, run 'cargo xtask install --server' to produce a server binary, or set __RA_LSP_SERVER_DEBUG to point at it.
  5. Reinstall the extension to restore the bundled server/ binary if it was deleted.

Example fix

// before: no config, relying on missing bundled binary
// after: set server path in settings.json
{
  "rust-analyzer.server.path": "/usr/local/bin/rust-analyzer"
}
Defensive patterns

Strategy: validation

Validate before calling

// Before calling bootstrap, pre-validate that a server can be resolved.
import * as vscode from 'vscode';
import { isValidExecutable } from './bootstrap';

async function ensureServerAvailable(config: Config): Promise<string | null> {
  // Check explicit path
  const explicit = process.env['__RA_LSP_SERVER_DEBUG'] ?? config.serverPath;
  if (explicit) {
    const expanded = explicit.startsWith('~/')
      ? os.homedir() + explicit.slice(1) : explicit;
    if (await isValidExecutable(expanded, config.serverExtraEnv)) return expanded;
    return null;
  }
  // Check PATH for rust-analyzer
  return null; // falls through to bundled logic
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of rust-lang/rust@7088e4b63a (2026-08-10). Data as JSON: /api/errors/ff6f223e6d94b8b2. Report an issue: GitHub.