Cargo "no such command" - Missing Cargo Subcommand in CI
Cargo found no built-in subcommand by that name and no cargo-X binary on PATH. The subcommand is a separate plugin (like cargo-audit or cargo-nextest) that was never installed on the runner.
What this error means
A step running cargo audit, cargo nextest, cargo deny, or similar fails with error: no such command: X`, often with a "did you mean" hint. Built-in commands like build and test` work - only the external subcommand is missing.
error: no such command: `nextest`
Did you mean `test`?
View all installed commands with `cargo --list`
Find a package to install `nextest` with `cargo search cargo-nextest`Common causes
The subcommand plugin isn’t installed
Subcommands like cargo-nextest, cargo-audit, cargo-deny, and cargo-tarpaulin are separate crates. Cargo resolves cargo X to a cargo-X binary on PATH; if it isn’t installed, there is nothing to run.
Installed but not on PATH
The plugin was installed to ~/.cargo/bin, but a later step runs in a shell where that directory isn’t on PATH, so the cargo-X binary isn’t found.
How to fix it
Install the subcommand
Install the plugin crate so the cargo-X binary exists. Prebuilt-binary installers are much faster than cargo install in CI.
# fast: prebuilt binary
- uses: taiki-e/install-action@v2
with:
tool: cargo-nextest
# or build it
cargo install cargo-nextest --lockedList what is actually available
See which subcommands Cargo can find, and confirm ~/.cargo/bin is on PATH.
cargo --list
echo "$PATH" | tr ':' '\n' | grep cargoHow to prevent it
- Install cargo subcommands explicitly in CI before using them.
- Prefer prebuilt-binary installers over
cargo installto save build time. - Cache
~/.cargo/binso installed subcommands persist across runs.