astral-sh/uv · error
No packages found in workspace
Error message
No packages found in workspace
What it means
Raised on the `--all-packages` path when workspace discovery succeeded but workspace.packages() is empty — the discovered workspace root has no members at all (not even itself as a package). This is checked before filtering for buildable packages, so it indicates a structural workspace problem rather than missing build-system tables.
Source
Thrown at crates/uv/src/commands/build_frontend.rs:406
package.root(),
)))]
} else if all_packages {
if matches!(src, Source::File(_)) {
return Err(anyhow::anyhow!(
"Cannot specify `--all-packages` when building from a file"
));
}
let workspace = match workspace {
Ok(ref workspace) => workspace,
Err(err) => {
return Err(err)
.context("`--all-packages` was provided, but no workspace was found");
}
};
if workspace.packages().is_empty() {
return Err(anyhow::anyhow!("No packages found in workspace"));
}
let packages: Vec<_> = workspace
.packages()
.values()
.filter(|package| package.pyproject_toml().is_package(true))
.map(|package| AnnotatedSource {
source: Source::Directory(Cow::Borrowed(package.root())),
package: Some(package.project().name.clone()),
})
.collect();
if packages.is_empty() {
let member = workspace.packages().values().next().unwrap();
let name = &member.project().name;
let pyproject_toml = member.root().join("pyproject.toml");
return Err(anyhow::anyhow!(
"Workspace does not contain any buildable packages. For example, to build `{}` with `{}`, add a `{}` to `{}`:\n```toml\n[build-system]\nrequires = [\"uv_build>={min_version},<{max_version}\"]\nbuild-backend = \"uv_build\"\n```",View on GitHub (pinned to f1a42680ff)
Solutions
- Add at least one package: create a pyproject.toml with [project] (+ [build-system]) in the root or a member directory.
- Fix `tool.uv.workspace.members` globs so they match the actual package directories.
- Loosen over-broad `tool.uv.workspace.exclude` patterns that remove every candidate.
- Verify you are running from the intended workspace root (`--directory`/`--project`).
Example fix
# before: root pyproject.toml [tool.uv.workspace] members = ["crates/*"] # crates/ does not exist # after [tool.uv.workspace] members = ["packages/*"] # matches packages/a, packages/b
Defensive patterns
Strategy: validation
Validate before calling
# Rust: assert non-empty workspace before building all packages
let workspace = Workspace::discover(dir, &DiscoveryOptions::default(), cache, ws_cache).await?;
anyhow::ensure!(
!workspace.packages().is_empty(),
"workspace at {} has no members; check tool.uv.workspace.members",
dir.display()
); Prevention
- Validate members globs against the real directory layout after restructuring.
- Add at least one package (pyproject.toml with [project]) before running --all-packages.
When it happens
Trigger: `uv build --all-packages` in a directory whose pyproject.toml declares a workspace but lists no buildable root package and no members; malformed tool.uv.workspace.members/exclude patterns matching nothing; running in an empty scaffold project.
Common situations: Newly initialized workspace where packages were planned but not added; globs in members (e.g., 'crates/*') that match no directories because the tree layout changed; exclude patterns accidentally filtering everything.
Related errors
- Package `{package}` not found in workspace
- Workspace does not contain any buildable packages. For examp
- pip-compile's `--config` is unsupported (uv does not use a c
- pip-sync's `--config` is unsupported (uv does not use a conf
- Multiple `pylock.toml` files specified: `{}` vs. `{}`
AI-assisted analysis of astral-sh/uv@f1a42680ff (2026-08-16).
Data as JSON: /api/errors/7cd3330eb516dd06.
Report an issue: GitHub.