{"record":{"id":"7e257225ecffc49a","repo":"astral-sh/uv","slug":"cannot-specify-paths-for-groups-with-a-pylock-tom","errorCode":null,"errorMessage":"Cannot specify paths for groups with a `pylock.toml` file; all groups must refer to the `pylock.toml` file","messagePattern":"Cannot specify paths for groups with a `pylock\\.toml` file; all groups must refer to the `pylock\\.toml` file","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/uv-requirements/src/specification.rs","lineNumber":494,"sourceCode":"            }\n            if !constraints.is_empty() {\n                return Err(anyhow::anyhow!(\n                    \"Cannot specify constraints with a `pylock.toml` file\"\n                ));\n            }\n            if !overrides.is_empty() {\n                return Err(anyhow::anyhow!(\n                    \"Cannot specify overrides with a `pylock.toml` file\"\n                ));\n            }\n\n            // If we have a `pylock.toml`, disallow specifying paths for groups; instead, require\n            // that all groups refer to the `pylock.toml` file.\n            if let Some(groups) = groups {\n                let mut names = Vec::new();\n                for group in &groups.groups {\n                    if group.path.is_some() {\n                        return Err(anyhow::anyhow!(\n                            \"Cannot specify paths for groups with a `pylock.toml` file; all groups must refer to the `pylock.toml` file\"\n                        ));\n                    }\n                    names.push(group.name.clone());\n                }\n\n                if !names.is_empty() {\n                    spec.groups.insert(\n                        pylock_toml.clone(),\n                        DependencyGroups::from_args(\n                            None,\n                            Vec::new(),\n                            Vec::new(),\n                            false,\n                            names,\n                            false,\n                        ),\n                    );","sourceCodeStart":476,"sourceCodeEnd":512,"githubUrl":"https://github.com/astral-sh/uv/blob/f1a42680ff5272232d65748acf338b19778dde24/crates/uv-requirements/src/specification.rs#L476-L512","documentation":"Thrown in RequirementsSpecification::from_sources (crates/uv-requirements/src/specification.rs:494) when requirements include a pylock.toml and a dependency-group entry carries a path. With a lock file, groups must resolve inside the lock itself (dependency-groups are encoded in pylock.toml), so `--group name@path`-style selections pointing at another file are rejected; path-less group names are collected and attached to the lock instead.","triggerScenarios":"`uv pip install -r pylock.toml --group 'dev@./pyproject.toml'` (any group selection whose path is Some) while a pylock.toml is the requirement source; also `--all-extras`/group flows that carry paths in other uv commands reaching this constructor.","commonSituations":"Monorepo scripts that enable groups from sibling pyproject.toml files reused against a lock install; users assuming group paths still work after adopting pylock.toml.","solutions":["Drop the path from the group selection: `--group dev` alone, letting it resolve against the pylock.toml's embedded groups","Ensure the lock actually contains the group (regenerate pylock.toml from a project whose pyproject.toml declares the dependency-group)","If you need groups from another file, install from that pyproject.toml instead of the lock"],"exampleFix":"# before\nuv pip install -r pylock.toml --group dev@../pyproject.toml\n# after\nuv pip install -r pylock.toml --group dev","handlingStrategy":"validation","validationCode":"let has_pylock = requirements.iter().any(|s| matches!(s, RequirementsSource::PylockToml(_)));\nif has_pylock {\n    if let Some(groups) = &groups {\n        if groups.groups.iter().any(|g| g.path.is_some()) {\n            return Err(anyhow::anyhow!(\"group paths are not allowed with pylock.toml; use bare group names\"));\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":"match RequirementsSpecification::from_sources(/* .. */, groups, /* .. */).await {\n    Err(err) if err.to_string().contains(\"Cannot specify paths for groups\") => {\n        // strip group paths (keep names) and reassemble\n    }\n    spec => spec?,\n}","preventionTips":["With a lock file, select groups by name only (`--group dev`)","Ensure dependency-groups are declared before exporting the lock so names resolve","Avoid reusing monorepo group-path invocations against pylock installs"],"tags":["uv","pylock-toml","dependency-groups","api-misuse","pip-interface"],"backgroundTag":null,"analyzedSha":"f1a42680ff5272232d65748acf338b19778dde24","analyzedAt":"2026-08-16T04:51:47.599Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}