{"id":"fd7d6b14e0d018cd","repo":"pypa/pip","slug":"dependency-groups-resolution-failed-for-groupn","errorCode":null,"errorMessage":"[dependency-groups] resolution failed for '{groupname}' from '{path}': {'; '.join(messages)}","messagePattern":"\\[dependency-groups\\] resolution failed for '(.+?)' from '(.+?)': (.+?)","errorType":"exception","errorClass":"InstallationError","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/req/req_dependency_group.py","lineNumber":35,"sourceCode":"    resolvers = _build_resolvers(path for (path, _) in groups)\n    return list(_resolve_all_groups(resolvers, groups))\n\n\ndef _resolve_all_groups(\n    resolvers: dict[str, DependencyGroupResolver], groups: list[tuple[str, str]]\n) -> Iterator[str]:\n    \"\"\"\n    Run all resolution, converting any error from `DependencyGroupResolver` into\n    an InstallationError.\n    \"\"\"\n    for path, groupname in groups:\n        resolver = resolvers[path]\n        try:\n            yield from (str(req) for req in resolver.resolve(groupname))\n        except ExceptionGroup as eg:\n            # Convert ExceptionGroup to a single InstallationError with all messages\n            messages = [str(e) for e in eg.exceptions]\n            raise InstallationError(\n                f\"[dependency-groups] resolution failed for '{groupname}' \"\n                f\"from '{path}': {'; '.join(messages)}\"\n            ) from eg\n\n\ndef _build_resolvers(paths: Iterable[str]) -> dict[str, Any]:\n    resolvers = {}\n    for path in paths:\n        if path in resolvers:\n            continue\n\n        pyproject = _load_pyproject(path)\n        if \"dependency-groups\" not in pyproject:\n            raise InstallationError(\n                f\"[dependency-groups] table was missing from '{path}'. \"\n                \"Cannot resolve '--group' option.\"\n            )\n        raw_dependency_groups = pyproject[\"dependency-groups\"]","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/pypa/pip/blob/d7d0d0a39494e28ec1c407bd0680e4a4d1067791/src/pip/_internal/req/req_dependency_group.py#L17-L53","documentation":"Raised by _resolve_all_groups() when DependencyGroupResolver.resolve(groupname) raises an ExceptionGroup while resolving a specific `[dependency-groups]` entry (req_dependency_group.py:32-38). All sub-exception messages are joined into a single InstallationError. This means the group was found but one or more requirement specifiers inside it are invalid or reference other groups incorrectly.","triggerScenarios":"Using `pip install --group mygroup` where pyproject.toml's [dependency-groups] has a malformed entry, an invalid PEP 508 requirement, a circular group reference, or references a non-existent group. The resolver (from packaging.dependency_groups) bundles failures into an ExceptionGroup which pip flattens.","commonSituations":"Typos in requirement specifiers within a dependency group. Self-referential or mutually-referential groups. Referencing an undefined group via `{another-group}` syntax. Migrating requirements files into groups with transcription errors.","solutions":["Read the joined messages in the error — each names a specific malformed entry; fix each one.","Ensure every requirement string in the group is valid PEP 508 (test with packaging.requirements.Requirement).","For group-to-group references using `{other}`, confirm the referenced group exists and is not circular.","Re-run `pip install --group mygroup` after corrections."],"exampleFix":"# before\n[dependency-groups]\nmygroup = [\"requests\", \"bad =spec\"]\n# after\n[dependency-groups]\nmygroup = [\"requests\", \"otherpkg>=1.0\"]","handlingStrategy":"validation","validationCode":"import tomllib\nfrom pip._vendor.packaging.dependency_groups import DependencyGroupResolver\nfrom pip._vendor.packaging.errors import ExceptionGroup\n\ndef validate_group_resolves(path: str, group: str) -> list[str]:\n    with open(path, \"rb\") as f:\n        data = tomllib.load(f)\n    raw = data.get(\"dependency-groups\", {})\n    resolver = DependencyGroupResolver(raw)\n    try:\n        return [str(r) for r in resolver.resolve(group)]\n    except ExceptionGroup as eg:\n        raise ValueError(\"; \".join(str(e) for e in eg.exceptions)) from eg","typeGuard":"null","tryCatchPattern":"from pip._internal.exceptions import InstallationError\n\ntry:\n    parse_dependency_groups([(path, group)])\nexcept InstallationError as e:\n    if \"resolution failed\" in str(e):\n        # show the joined sub-error messages to the user\n        ...\n    raise","preventionTips":["Validate every requirement string inside [dependency-groups] with packaging.requirements.Requirement in CI.","Avoid circular or undefined `{group}` references.","Test `pip install --group <name>` locally before pushing changes."],"tags":["dependency-groups","pep735","toml","validation"],"analyzedSha":"d7d0d0a39494e28ec1c407bd0680e4a4d1067791","analyzedAt":"2026-08-04T20:55:04.259Z","schemaVersion":2}