Skip to content
Latchkey

Cargo "virtual manifest ... requires a package" in CI

You ran a package-level command (run, install, publish) at a workspace root that has only a [workspace] table and no [package]. Cargo does not know which member to act on, so it refuses.

What this error means

A cargo run, cargo install --path ., or similar fails at the workspace root with "this virtual manifest specifies a [workspace], but no package". The same command works inside a member directory.

cargo
error: this virtual manifest specifies a `[workspace]`, but no package.
  To run a command on a package, use `cargo <command> -p <package>`,
  or run the command from within the package directory.

Common causes

Package command at a virtual workspace root

A virtual manifest (only [workspace], no [package]) cannot be the target of a package-scoped command. Cargo has no single package to use.

No default-members declared

Without workspace.default-members, cargo cannot pick a default package for run/build at the root, so it errors instead of guessing.

How to fix it

Name the package with -p

Tell cargo exactly which member to operate on.

Terminal
cargo run -p my-app
cargo build -p my-app --locked

Declare default-members in the root

Let cargo pick a default member for root-level commands.

Cargo.toml
# Cargo.toml (workspace root)
[workspace]
members = ["crates/*"]
default-members = ["crates/my-app"]

How to prevent it

  • Pass -p <pkg> for package commands run at a virtual workspace root.
  • Set workspace.default-members so root-level run/build have a target.
  • Run member-scoped commands from inside the member directory in CI.

Frequently asked questions

What causes ""this virtual manifest...""?
A virtual manifest (only [workspace], no [package]) cannot be the target of a package-scoped command. Cargo has no single package to use.
How do I fix "this virtual manifest..."?
Tell cargo exactly which member to operate on.

Related guides

References

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