{"record":{"id":"75aa5d88a9a4b14a","repo":"astral-sh/uv","slug":"package-is-missing-a-for-example-to-bu","errorCode":null,"errorMessage":"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```","messagePattern":"Package `(.+?)` is missing a `(.+?)`\\. For example, to build with `(.+?)`, add the following to `(.+?)`:\n```toml\n\\[build-system\\]\nrequires = \\[\"uv_build>=(.+?),<(.+?)\"\\]\nbuild-backend = \"uv_build\"\n```","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/uv/src/commands/build_frontend.rs","lineNumber":378,"sourceCode":"            ));\n        }\n\n        let workspace = match workspace {\n            Ok(ref workspace) => workspace,\n            Err(err) => {\n                return Err(err).context(\"`--package` was provided, but no workspace was found\");\n            }\n        };\n\n        let package = workspace\n            .packages()\n            .get(package)\n            .ok_or_else(|| anyhow::anyhow!(\"Package `{package}` not found in workspace\"))?;\n\n        if !package.pyproject_toml().is_package(true) {\n            let name = &package.project().name;\n            let pyproject_toml = package.root().join(\"pyproject.toml\");\n            return Err(anyhow::anyhow!(\n                \"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```\",\n                name.cyan(),\n                \"build-system\".green(),\n                \"uv_build\".cyan(),\n                pyproject_toml.user_display().cyan()\n            ));\n        }\n\n        vec![AnnotatedSource::from(Source::Directory(Cow::Borrowed(\n            package.root(),\n        )))]\n    } else if all_packages {\n        if matches!(src, Source::File(_)) {\n            return Err(anyhow::anyhow!(\n                \"Cannot specify `--all-packages` when building from a file\"\n            ));\n        }\n","sourceCodeStart":360,"sourceCodeEnd":396,"githubUrl":"https://github.com/astral-sh/uv/blob/f1a42680ff5272232d65748acf338b19778dde24/crates/uv/src/commands/build_frontend.rs#L360-L396","documentation":"`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.","triggerScenarios":"`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.","commonSituations":"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.","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."],"exampleFix":"# before: crates/mylib/pyproject.toml has only [project]\n# after: append\n[build-system]\nrequires = [\"uv_build>=0.8,<0.9\"]\nbuild-backend = \"uv_build\"","handlingStrategy":"validation","validationCode":"# Rust: pre-check buildability before selecting a package\nlet pkg = workspace.packages().get(&name)\n    .ok_or_else(|| anyhow::anyhow!(\"{name} not in workspace\"))?;\nif !pkg.pyproject_toml().is_package(true) {\n    anyhow::bail!(\"{name} lacks [build-system]; add it before building\");\n}","typeGuard":"fn is_buildable(pkg: &WorkspacePackage) -> bool {\n    pkg.pyproject_toml().is_package(true)\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["build","build-system","pyproject","package-selection"],"backgroundTag":null,"analyzedSha":"f1a42680ff5272232d65748acf338b19778dde24","analyzedAt":"2026-08-16T04:51:47.599Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}