/errors/cargo/could-not-find-cargo-toml
error: could not find `Cargo.toml` in `...` or any parent directory
verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash) · cargo 1.98.1 (797e8a9bc 2026-08-05)updated
- tool
- Cargo
- exit code
- 101
- versions
- Cargo 1.x
- os
- any
error: could not find Cargo.toml in <dir> or any parent directory means Cargo looked for a package manifest in the current folder and in every folder above it, and found none. Cargo commands such as build, run and test need to run inside a package. cd into the project, pass --manifest-path, or create a package with cargo new or cargo init.
Reproduce it
cargo build
echo "exit status: $?"Output
error: could not find `Cargo.toml` in `/tmp/work` or any parent directory exit status: 101
Cargo searches upwards, so running it in a subfolder of a package (such as src/) works; only folders outside every package fail.
Fixes
cargo new -q --vcs none hello
cargo run -q --manifest-path hello/Cargo.toml
cd hello/src && cargo run -qOutput
Hello, world! Hello, world!
| Situation | Fix |
|---|---|
| You are in the parent folder | cd NAME, or cargo build --manifest-path NAME/Cargo.toml |
| Sources exist, no manifest | cargo init in that folder |
| New project | cargo new NAME |
| Workspace member | cargo build -p MEMBER from the workspace root |
Sources
Related pages
cheat sheets · cargoCargo cheat sheet: build, run, test and manage Rust cratesCargo cheat sheet: new packages, check, build and run in debug or release, test, fmt, clippy, add and update dependencies, workspaces and flags for CI.flags · cargocargo build --release: optimised builds and target/releasecargo build --release uses the release profile (opt-level 3, no overflow checks) and writes to target/release. Debug vs release, and how to tune the profile.errors · rustRust error[E0382]: borrow of moved valuerustc reports E0382 when a variable is used after its value moved to another binding or function. Borrow it with &, clone it, or reorder the code. Real output.