Skip to content
Latchkey

Rust "error[E0463]: can't find crate for `std`" in CI

You are cross-compiling to a target whose standard library isn’t installed. rustc can’t find std for that target because the precompiled rust-std component was never added via rustup.

What this error means

A --target build fails with error[E0463]: can't find crate for std` (sometimes with a note that std` isn’t available for the target). The host build works; only the cross-target build fails for lack of its std.

cargo output
error[E0463]: can't find crate for `std`
  |
  = note: the `aarch64-unknown-linux-musl` target may not be installed
  = help: consider downloading the target with `rustup target add aarch64-unknown-linux-musl`

Common causes

Target std component not installed

Each cross-compilation target needs its own precompiled std (rust-std). Without rustup target add <target>, rustc has no std for it.

A no_std-only or tier-3 target

Some targets ship no prebuilt std at all. For those you need -Z build-std on nightly, or a #![no_std] crate, rather than a missing component.

How to fix it

Add the target’s std

rustup’s help line names the exact command - install the target component.

Terminal
rustup target add aarch64-unknown-linux-musl
cargo build --target aarch64-unknown-linux-musl

Request the target in the setup action

.github/workflows/ci.yml
- uses: dtolnay/rust-toolchain@stable
  with:
    targets: aarch64-unknown-linux-musl

How to prevent it

  • Install every cross-target with rustup target add in CI setup.
  • Declare targets in the toolchain action so they’re always present.
  • Cache the toolchain so target components persist across runs.

Frequently asked questions

What causes ""E0463: can't find crate for std""?
Each cross-compilation target needs its own precompiled std (rust-std). Without rustup target add <target>, rustc has no std for it.
How do I fix "E0463: can't find crate for std"?
rustup’s help line names the exact command - install the target component.
Can Latchkey fix this automatically?
Yes. Latchkey runs your GitHub Actions on managed runners that detect this failure, apply the fix, and retry the job automatically - self-healing is on by default.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card