Skip to content
Latchkey

Rust "the cargo binary ... does not exist" for a Toolchain in CI

rustup selected a toolchain whose cargo binary is missing. The toolchain install is partial or corrupt -- often from an interrupted download or a half-restored cache -- so the active toolchain has no usable cargo.

What this error means

A cargo invocation fails with the 'cargo' binary, normally found at <path>, does not exist. rustup thinks the toolchain is installed, but the binary is absent, usually after a broken install or truncated cache restore.

rustup
error: the 'cargo' binary, normally found at
'/home/runner/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo',
does not exist

Common causes

Partial or corrupt toolchain install

An interrupted rustup install (network drop, cancelled job) left the toolchain directory present but missing the cargo binary.

Truncated or stale toolchain cache

A restored ~/.rustup cache that was saved mid-install -- or partially restored -- contains a toolchain metadata entry without the actual binaries.

How to fix it

Reinstall the toolchain

Force a clean reinstall so the binaries are restored.

Terminal
rustup toolchain uninstall stable
rustup toolchain install stable
cargo --version

Clear a corrupt cache and re-fetch

If a bad cache is the source, drop it and let rustup reinstall cleanly.

Terminal
rm -rf ~/.rustup/toolchains/stable-*
rustup toolchain install stable

How to prevent it

  • Cache ~/.rustup only after the toolchain install succeeds.
  • Reinstall the toolchain if a cargo binary goes missing.
  • Avoid saving caches from cancelled or failed setup steps.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →