rust-lang/rust-analyzer · error
failed
Error message
{:?} failed, {} What it means
utf8_stdout's fallback bail: the command exited non-zero but no usable stderr was captured (empty stderr or invalid UTF-8). It reports only the command and exit status, so the cause must be inferred from the command itself. Same family as the stderr variant but with no diagnostic output attached.
Solutions
- Check that `rustc`/`cargo`/`rustup` are installed and on PATH (`which rustc; rustc --version`).
- Re-run the exact command from the message manually to reproduce and see any output.
- Fix environment variables (PATH, RUSTUP_HOME, CARGO_HOME, RUSTUP_TOOLCHAIN) that may point at broken installs.
- If the process is being killed, check memory/disk resources.
Example fix
// before $ echo $PATH # rustc not present // after $ rustup default stable $ export PATH="$HOME/.cargo/bin:$PATH" $ rustc --version
Defensive patterns
Strategy: retry
Validate before calling
let ok = Command::new("rustc").arg("--version").output()
.map(|o| o.status.success() && !o.stdout.is_empty())
.unwrap_or(false);
if !ok { /* repair toolchain / PATH before invoking library code */ } Try / catch
// no stderr is attached, so retry after fixing the environment
match result {
Err(e) if e.to_string().contains("failed, exit status") => {
// re-check PATH/toolchain, then retry once
retry_after_env_fix()
}
other => other,
} Prevention
- Verify the executable exists on PATH before running.
- Check for signal kills (OOM) if the failure is intermittent.
- Ensure stderr encoding issues (locales, wrappers) are excluded from the toolchain commands.
- Log the exact command from the message and run it manually to debug.
When it happens
Trigger: utf8_stdout running a command that exits non-zero with empty or non-UTF-8 stderr — e.g. `rustc --print sysroot` when rustc is absent from PATH, killed by a signal, or emitting binary garbage on stderr.
Common situations: rustc/cargo not on PATH (broken environment); command killed (OOM/signal) producing no stderr; locale/encoding issues making stderr non-UTF-8; wrapper scripts exiting silently.
Related errors
AI-assisted analysis of rust-lang/rust-analyzer@e8f7e90aa3 (2026-09-03).
Data as JSON: /api/errors/ffad09ffa17781be.
Report an issue: GitHub.
Appendix: source
Thrown at crates/project-model/src/lib.rs:220
| ProjectManifest::CargoScript(it) => it,
}
}
}
impl fmt::Display for ProjectManifest {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(self.manifest_path(), f)
}
}
fn utf8_stdout(cmd: &mut Command) -> anyhow::Result<String> {
let output = cmd.output().with_context(|| format!("{cmd:?} failed"))?;
if !output.status.success() {
match String::from_utf8(output.stderr) {
Ok(stderr) if !stderr.is_empty() => {
bail!("{:?} failed, {}\nstderr:\n{}", cmd, output.status, stderr)
}
_ => bail!("{:?} failed, {}", cmd, output.status),
}
}
let stdout = String::from_utf8(output.stdout)?;
Ok(stdout.trim().to_owned())
}
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub enum InvocationStrategy {
Once,
#[default]
PerWorkspace,
}
/// A set of cfg-overrides per crate.
#[derive(Default, Debug, Clone, Eq, PartialEq)]
pub struct CfgOverrides {
/// A global set of overrides matching all crates.
pub global: cfg::CfgDiff,View on GitHub (pinned to e8f7e90aa3)