rust-lang/rust · critical · Error
Failed to execute --version.
Error message
Failed to execute ${path} --version. What it means
Thrown by bootstrap() at line 24-31 after isValidExecutable() returns false. isValidExecutable() spawns the resolved server binary with ['--version'] using the merged process + serverExtraEnv, and returns true only when the child exits with status 0. A false return means the binary was found but could not be executed successfully. When serverPath was explicitly set, the error appends guidance to remove or fix that config.
Solutions
- Run the resolved path manually in a terminal: '/path/to/rust-analyzer --version' to see the actual OS-level error (missing .so, permission denied, exec format error).
- Fix execute permissions: 'chmod +x /path/to/rust-analyzer'.
- If the binary is the wrong architecture, reinstall or rebuild it for the host platform (rustup component add rust-analyzer, or rustup update).
- Remove the explicit 'rust-analyzer.server.path' setting so the extension falls back to its bundled or PATH-resolved binary.
- Check serverExtraEnv settings for environment variables that break the binary's runtime (e.g. LD_LIBRARY_PATH pointing at wrong libs).
Example fix
// before: serverPath points at a broken/wrong-arch binary
// settings.json
{ "rust-analyzer.server.path": "/home/user/old-build/ra" }
// after: remove the setting to use bundled binary
// (delete the key) or
{ "rust-analyzer.server.path": "/home/user/.cargo/bin/rust-analyzer" } Defensive patterns
Strategy: validation
Validate before calling
import { isValidExecutable } from './bootstrap';
// Pre-check before relying on a server path
const valid = await isValidExecutable(candidatePath, config.serverExtraEnv);
if (!valid) {
// Show actionable guidance before bootstrap throws
vscode.window.showWarningMessage(
`rust-analyzer binary at ${candidatePath} is not executable. Check permissions and architecture.`
);
} Try / catch
try {
const serverPath = await bootstrap(context, config, state);
// proceed
} catch (e) {
if (e.message.includes('Failed to execute') && e.message.includes('--version')) {
// Specific: binary found but won't run
log.error('Server binary exists but is not executable/compatible', e);
}
throw e;
} Prevention
- After setting serverPath, test it manually: run the binary with --version in a terminal.
- Ensure the binary has execute permission (chmod +x).
- Verify the binary matches the host architecture (uname -m vs file <binary>).
- Keep serverExtraEnv minimal — avoid LD_LIBRARY_PATH or DYLD_* overrides unless necessary.
When it happens
Trigger: isValidExecutable(path, config.serverExtraEnv) returns false at bootstrap.ts:24. Specifically: spawnAsync(path, ['--version'], {env}) at line 213 returns a result whose res.status !== 0 (line 222). This covers: the binary exists but is not executable (permissions), has an incompatible architecture (e.g. x86 binary on ARM), has missing shared libraries, is a Windows .exe on Linux or vice versa, or the --version invocation crashes/exits non-zero.
Common situations: Configuring serverPath to a binary built for a different OS/arch; missing execute permission bit after a manual copy; corrupted or partially-built binary; mismatched dynamic linker (especially on non-NixOS systems with custom lib paths); a stale serverPath pointing at an old or broken build after an upgrade.
Related errors
- rust-analyzer Language Server is not available. Please…
- bootstrap error. See the logs in "OUTPUT > Rust Analyzer…
- Please set `rust-analyzer.profiling.memoryProfile` to the…
- proc-macro-srv-cli needs to be compiled with the…
- A receiver has been dropped, something panicked!
AI-assisted analysis of rust-lang/rust@7088e4b63a (2026-08-10).
Data as JSON: /api/errors/6c10eac7322461e4.
Report an issue: GitHub.
Appendix: source
Thrown at src/tools/rust-analyzer/editors/code/src/bootstrap.ts:25
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;
}
async function getServer(
context: vscode.ExtensionContext,
config: Config,
state: PersistentState,
): Promise<string | undefined> {
const packageJson: {
version: string;
releaseTag: string | null;View on GitHub (pinned to 7088e4b63a)