Cargo "failed to load manifest for workspace member" in CI
Cargo read your workspace’s members list (or a glob) and could not load one of the crates it names. A member directory was moved, deleted, or never checked out, so the workspace manifest references a crate that isn’t there.
What this error means
cargo aborts before building with failed to load manifest for workspace member <path> or package X is not a member of workspace. The workspace can’t even be assembled, so nothing in it builds - common after a crate is renamed or a member is excluded from the CI checkout.
error: failed to load manifest for workspace member `/home/runner/work/app/crates/api`
referenced by workspace at `/home/runner/work/app/Cargo.toml`
Caused by:
failed to read `/home/runner/work/app/crates/api/Cargo.toml`
Caused by:
No such file or directory (os error 2)Common causes
A members path or glob points at a missing crate
The [workspace] members = [...] list (or a crates/* glob) names a directory that was moved, renamed, or removed, so Cargo can’t read its Cargo.toml.
A member wasn’t included in the CI checkout
A sparse checkout, a submodule that wasn’t initialized, or a path member living in another repo means the directory is absent on the runner even though it exists locally.
How to fix it
Align the members list with the real directories
Update the workspace manifest so every member resolves on the runner, using a glob if members come and go.
[workspace]
members = ["crates/*"] # or list explicit, existing paths
exclude = ["crates/scratch"]Make sure every member is checked out
- Run
find . -name Cargo.toml -maxdepth 3in a debug step to see which members exist. - Initialize submodules (
actions/checkoutwithsubmodules: recursive) if a member is a submodule. - For members in another repo, check that repo out into the expected relative path.
How to prevent it
- Use a
crates/*glob so adding/removing members doesn’t desync the list. - Keep
members/excludeupdated whenever you move or rename a crate. - Check out submodules and sibling-repo members in CI so paths resolve.