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.
error: the 'cargo' binary, normally found at
'/home/runner/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo',
does not existCommon 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.
rustup toolchain uninstall stable
rustup toolchain install stable
cargo --versionClear a corrupt cache and re-fetch
If a bad cache is the source, drop it and let rustup reinstall cleanly.
rm -rf ~/.rustup/toolchains/stable-*
rustup toolchain install stableHow to prevent it
- Cache
~/.rustuponly after the toolchain install succeeds. - Reinstall the toolchain if a cargo binary goes missing.
- Avoid saving caches from cancelled or failed setup steps.