astral-sh/uv · error
Package `{}` is missing a `{}`. For example, to build with `
Error message
Package `{}` is missing a `{}`. For example, to build with `{}`, add the following to `{}`:
```toml
[build-system]
requires = ["uv_build>={min_version},<{max_version}"]
build-backend = "uv_build"
``` What it means
`uv build --package <name>` found the member but its pyproject.toml fails is_package(true): there is no usable `[build-system]` table (with require_build_system semantics), so uv does not know how to build it. The message embeds a ready-to-paste `[build-system]` snippet pinned to the running uv's version range, using the uv_build backend.
Source
Thrown at crates/uv/src/commands/build_frontend.rs:378
));
}
let workspace = match workspace {
Ok(ref workspace) => workspace,
Err(err) => {
return Err(err).context("`--package` was provided, but no workspace was found");
}
};
let package = workspace
.packages()
.get(package)
.ok_or_else(|| anyhow::anyhow!("Package `{package}` not found in workspace"))?;
if !package.pyproject_toml().is_package(true) {
let name = &package.project().name;
let pyproject_toml = package.root().join("pyproject.toml");
return Err(anyhow::anyhow!(
"Package `{}` is missing a `{}`. For example, to build with `{}`, add the following to `{}`:\n```toml\n[build-system]\nrequires = [\"uv_build>={min_version},<{max_version}\"]\nbuild-backend = \"uv_build\"\n```",
name.cyan(),
"build-system".green(),
"uv_build".cyan(),
pyproject_toml.user_display().cyan()
));
}
vec![AnnotatedSource::from(Source::Directory(Cow::Borrowed(
package.root(),
)))]
} else if all_packages {
if matches!(src, Source::File(_)) {
return Err(anyhow::anyhow!(
"Cannot specify `--all-packages` when building from a file"
));
}
View on GitHub (pinned to f1a42680ff)
Solutions
- Add the exact `[build-system]` table shown in the error to the member's pyproject.toml (adjust the backend if you use setuptools/hatchling/flit instead of uv_build).
- If the member is intentionally non-buildable (virtual), don't target it with --package; build a real package instead.
- After editing, re-run `uv build --package <name>` from the workspace root.
Example fix
# before: crates/mylib/pyproject.toml has only [project] # after: append [build-system] requires = ["uv_build>=0.8,<0.9"] build-backend = "uv_build"
Defensive patterns
Strategy: validation
Validate before calling
# Rust: pre-check buildability before selecting a package
let pkg = workspace.packages().get(&name)
.ok_or_else(|| anyhow::anyhow!("{name} not in workspace"))?;
if !pkg.pyproject_toml().is_package(true) {
anyhow::bail!("{name} lacks [build-system]; add it before building");
} Type guard
fn is_buildable(pkg: &WorkspacePackage) -> bool {
pkg.pyproject_toml().is_package(true)
} Prevention
- Give every buildable member an explicit [build-system] table — uv never assumes a default backend.
- In repo CI, lint that each workspace member intended for builds has build-system.requires and build-backend.
When it happens
Trigger: `uv build --package lib-x` where lib-x is a virtual/library member with only `[project]` and no `[build-system]`; member configured with a build backend uv considers non-buildable for this path; freshly split-out package whose pyproject.toml was copied without the build-system section.
Common situations: Workspaces that mix virtual helper packages and buildable ones; migrating packages from setuptools where the section was omitted (implicit backend) — uv requires it to be explicit for --package builds.
Related errors
- Cannot specify `--package` when building from a file
- Package `{package}` not found in workspace
- Cannot specify `--all-packages` when building from a file
- Workspace does not contain any buildable packages. For examp
- Source `{}` does not exist
AI-assisted analysis of astral-sh/uv@f1a42680ff (2026-08-16).
Data as JSON: /api/errors/75aa5d88a9a4b14a.
Report an issue: GitHub.