{"record":{"id":"7cd3330eb516dd06","repo":"astral-sh/uv","slug":"no-packages-found-in-workspace","errorCode":null,"errorMessage":"No packages found in workspace","messagePattern":"No packages found in workspace","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/uv/src/commands/build_frontend.rs","lineNumber":406,"sourceCode":"            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\n        let workspace = match workspace {\n            Ok(ref workspace) => workspace,\n            Err(err) => {\n                return Err(err)\n                    .context(\"`--all-packages` was provided, but no workspace was found\");\n            }\n        };\n\n        if workspace.packages().is_empty() {\n            return Err(anyhow::anyhow!(\"No packages found in workspace\"));\n        }\n\n        let packages: Vec<_> = workspace\n            .packages()\n            .values()\n            .filter(|package| package.pyproject_toml().is_package(true))\n            .map(|package| AnnotatedSource {\n                source: Source::Directory(Cow::Borrowed(package.root())),\n                package: Some(package.project().name.clone()),\n            })\n            .collect();\n\n        if packages.is_empty() {\n            let member = workspace.packages().values().next().unwrap();\n            let name = &member.project().name;\n            let pyproject_toml = member.root().join(\"pyproject.toml\");\n            return Err(anyhow::anyhow!(\n                \"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```\",","sourceCodeStart":388,"sourceCodeEnd":424,"githubUrl":"https://github.com/astral-sh/uv/blob/f1a42680ff5272232d65748acf338b19778dde24/crates/uv/src/commands/build_frontend.rs#L388-L424","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","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`)."],"exampleFix":"# before: root pyproject.toml\n[tool.uv.workspace]\nmembers = [\"crates/*\"]   # crates/ does not exist\n# after\n[tool.uv.workspace]\nmembers = [\"packages/*\"]  # matches packages/a, packages/b","handlingStrategy":"validation","validationCode":"# Rust: assert non-empty workspace before building all packages\nlet workspace = Workspace::discover(dir, &DiscoveryOptions::default(), cache, ws_cache).await?;\nanyhow::ensure!(\n    !workspace.packages().is_empty(),\n    \"workspace at {} has no members; check tool.uv.workspace.members\",\n    dir.display()\n);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate members globs against the real directory layout after restructuring.","Add at least one package (pyproject.toml with [project]) before running --all-packages."],"tags":["build","workspace","configuration"],"backgroundTag":null,"analyzedSha":"f1a42680ff5272232d65748acf338b19778dde24","analyzedAt":"2026-08-16T04:51:47.599Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}