Skip to content
Latchkey

Rust "target may not be installed" - rustup target add in CI

A --target build references a target triple that rustup hasn’t installed. The host toolchain is fine, but the cross-compilation target’s components were never added, so cargo can’t build for it.

What this error means

cargo build --target ... fails noting the target "may not be installed" or that the target is unknown. Frequently seen for wasm32-unknown-unknown, musl, or ARM targets on a fresh runner.

cargo output
error[E0463]: can't find crate for `core`
note: the `wasm32-unknown-unknown` target may not be installed
help: consider downloading the target with `rustup target add wasm32-unknown-unknown`

Common causes

Cross target never added

Targets like wasm32-unknown-unknown or x86_64-unknown-linux-musl aren’t installed by default. Building for them without rustup target add fails to find core/std.

Fresh runner without cached targets

A cold runner starts with only the host target. Any cross build needs the target component re-added each run unless the toolchain is cached.

How to fix it

Add the target before building

Terminal
rustup target add wasm32-unknown-unknown
cargo build --target wasm32-unknown-unknown

List installed targets to verify

Confirm which targets rustup actually has before the build step.

Terminal
rustup target list --installed

How to prevent it

  • Add cross targets in the setup action’s targets: list.
  • Cache ~/.rustup so installed targets persist across runs.
  • Assert the target is installed before the build step.

Frequently asked questions

What causes "target not installed"?
Targets like wasm32-unknown-unknown or x86_64-unknown-linux-musl aren’t installed by default. Building for them without rustup target add fails to find core/std.
How do I fix target not installed?
Add the target before building
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