{"id":"105c7b37dad7560c","repo":"python-poetry/poetry","slug":"group-s-not-found-join-message-parts","errorCode":null,"errorMessage":"Group(s) not found: {', '.join(message_parts)}","messagePattern":"Group\\(s\\) not found: (.+?)","errorType":"validation","errorClass":"GroupNotFoundError","httpStatus":null,"severity":"error","filePath":"src/poetry/console/commands/group_command.py","lineNumber":134,"sourceCode":"\n    def _validate_group_options(self, group_options: dict[str, set[str]]) -> None:\n        \"\"\"\n        Raises an error if it detects that a group is not part of pyproject.toml\n        \"\"\"\n        invalid_options = defaultdict(set)\n        for opt, groups in group_options.items():\n            for group in groups:\n                if not self.poetry.package.has_dependency_group(group):\n                    invalid_options[group].add(opt)\n        if invalid_options:\n            message_parts = []\n            for group in sorted(invalid_options):\n                opts = \", \".join(\n                    f\"<fg=yellow;options=bold>--{opt}</>\"\n                    for opt in sorted(invalid_options[group])\n                )\n                message_parts.append(f\"{group} (via {opts})\")\n            raise GroupNotFoundError(f\"Group(s) not found: {', '.join(message_parts)}\")\n","sourceCodeStart":116,"sourceCodeEnd":135,"githubUrl":"https://github.com/python-poetry/poetry/blob/92b74dcfe348d0e01e14d40d6c1fa47a4ee04a54/src/poetry/console/commands/group_command.py#L116-L135","documentation":"`GroupNotFoundError` from `_validate_group_options` (group_command.py:117-134) when a dependency group passed to `--with`, `--without`, or `--only` is not declared in `pyproject.toml` (neither `[tool.poetry.group.<g>]` nor `[dependency-groups]`). Poetry validates group names against `package.has_dependency_group` before operating.","triggerScenarios":"Running `poetry install --with docs` when no `docs` group exists; `--without ci` when there is no `ci` group; typos in group names.","commonSituations":"Renaming a group in pyproject but forgetting CI flags; assuming a group exists because the directory does; mixing PEP 735 `[dependency-groups]` and legacy `[tool.poetry.group]` names.","solutions":["List declared groups with `poetry show --tree` or inspect `[tool.poetry.group]` / `[dependency-groups]` in pyproject.toml.","Correct the flag to an existing group name.","If the group should exist, declare it in pyproject.toml first."],"exampleFix":"# before\npoetry install --with doc\n# after\npoetry install --with docs","handlingStrategy":"validation","validationCode":"from poetry.factory import Factory\npoetry = Factory().create_poetry()\ngroups = set(poetry.package.dependency_group_names())\nrequested = {\"docs\", \"test\"}\nmissing = requested - groups\nif missing:\n    raise SystemExit(f\"unknown groups: {sorted(missing)}\")","typeGuard":"def group_exists(poetry, name: str) -> bool:\n    return poetry.package.has_dependency_group(name)","tryCatchPattern":null,"preventionTips":["Derive `--with`/`--without`/`--only` from pyproject.toml at script time.","Keep group names in a single source of truth.","Run `poetry show --groups` (or inspect pyproject) before scripting."],"tags":["dependency-groups","cli-args","validation"],"analyzedSha":"92b74dcfe348d0e01e14d40d6c1fa47a4ee04a54","analyzedAt":"2026-08-04T20:33:34.072Z","schemaVersion":2}