`compute build` can validate the wrong `cargo`

Open
#1,897 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
62/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
go, rust
Domain
build-system, cli

Research direction

Start at the fastly compute build entry point and its preflight/toolchain validation, then reproduce the issue with the provided cargo, rustc, rustup, and PATH commands. Done means Homebrew's shadowing cargo is detected before compilation and the user receives actionable guidance when the selected toolchain lacks wasm32-wasip1.

Written by the indexing model from the issue text.

Description

bug

Version

Fastly CLI version v16.0.0 (Homebrew)
Built with go version go1.26.5 darwin/arm64 (2026-08-27)
Viceroy version: viceroy 0.20.1

macOS 26.6.2, Homebrew 6.0.19

What happened

I used homebrew to install both rust and rustup on my machine. I have wasm32-wasip1 installed, but homebrew's rust and cargo shadows the rustup version. When I init a new compute service the preflight check detects wasm32-wasip1 and passes, and the build fails ~20 crates in with unhelpful advice that won't fix the issue.

In a clean directory I ran:

$ fastly compute init --non-interactive --language rust \
  --from https://github.com/fastly/compute-starter-kit-rust-default
$ fastly compute build
Result:
✓ Verifying fastly.toml
✓ Identifying package name
✓ Identifying toolchain
✗ Running [scripts.build]

INFO: Command output:
--------------------------------------------------------------------------------
   Compiling proc-macro2 v1.0.106


   ... ~20 more crates ...


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

error[E0463]: can't find crate for `std`
  = note: the `wasm32-wasip1` target may not be installed
  = help: consider downloading the target with `rustup target add wasm32-wasip1`

error: could not compile `itoa` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `stable_deref_trait` (lib) due to 1 previous error


   ... 5 more `could not compile` lines ...
--------------------------------------------------------------------------------

ERROR: error during execution process (see 'command output' above): exit status 101.
Expected

I suppose I expected that it would init without an error, but after figuring out the PATH shadowing I'd be happy with a preflight check and an actionable error.

Investigation

The target is installed in rustup:

$ rustup target list --installed
aarch64-apple-darwin
wasm32-wasip1

$ rustup target add wasm32-wasip1
info: component rust-std for target wasm32-wasip1 is up to date

So I look at the rest of the environment to see which version of rust / cargo / the toolchain I'm running.

$ command -v cargo rustc
/opt/homebrew/bin/cargo
/opt/homebrew/bin/rustc

$ cargo --version
cargo 1.97.1 (c980f4866 2026-06-30) (Homebrew)

$ rustup which cargo
/Users/lonnen/.rustup/toolchains/stable-aarch64-apple-darwin/bin/cargo

$ echo "$PATH" | tr ":" '\n'
...
/Users/lonnen/.cargo/bin
/opt/homebrew/bin
/opt/homebrew/sbin
...
Dominant language
Go
Stars
164
Forks
80
Avg merge
14h 22m
Merged PRs (30d)
17

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fastly/cli

All issues in fastly/cli

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.