{"record":{"id":"5e5be6b47d51e68b","repo":"pypa/pip","slug":"all-releases-only-final-option-requires-1-ar","errorCode":null,"errorMessage":"--all-releases / --only-final option requires 1 argument.","messagePattern":"--all-releases / --only-final option requires 1 argument\\.","errorType":"validation","errorClass":"CommandError","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/models/release_control.py","lineNumber":33,"sourceCode":"    only_final: set[str] = field(default_factory=set)\n    _order: list[tuple[str, str]] = field(\n        init=False, default_factory=list, compare=False, repr=False\n    )\n\n    def handle_mutual_excludes(\n        self, value: str, target: set[str], other: set[str], attr_name: str\n    ) -> None:\n        \"\"\"Parse and apply release control option value.\n\n        Processes comma-separated package names or special values `:all:` and `:none:`.\n\n        When adding packages to target, they're removed from other to maintain mutual\n        exclusivity between all_releases and only_final. All operations are tracked in\n        order so that the original command-line argument sequence can be reconstructed\n        when passing options to build subprocesses.\n        \"\"\"\n        if value.startswith(\"-\"):\n            raise CommandError(\n                \"--all-releases / --only-final option requires 1 argument.\"\n            )\n        new = value.split(\",\")\n        while \":all:\" in new:\n            other.clear()\n            target.clear()\n            target.add(\":all:\")\n            # Track :all: in order\n            self._order.append((attr_name, \":all:\"))\n            del new[: new.index(\":all:\") + 1]\n            # Without a none, we want to discard everything as :all: covers it\n            if \":none:\" not in new:\n                return\n        for name in new:\n            if name == \":none:\":\n                target.clear()\n                # Track :none: in order\n                self._order.append((attr_name, \":none:\"))","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/pypa/pip/blob/f399c3718970b1b0e2478dac5296eb62679a9b86/src/pip/_internal/models/release_control.py#L15-L51","documentation":"Raised as a CommandError by ReleaseControl.handle_mutual_excludes when the value passed to --all-releases or --only-final starts with a '-', i.e. it looks like the next CLI flag rather than a real argument. These options each require exactly one argument (a package name, ':all:', ':none:', or a comma-separated list), so a flag-like value means the option was supplied without its argument.","triggerScenarios":"Running pip install with '--all-releases' immediately followed by another option (e.g. '--all-releases --only-final pkg'), or argparse forwarding a '-'-prefixed token. handle_mutual_excludes sees value.startswith('-') and aborts before canonicalizing.","commonSituations":"Treating the new release-control options as boolean flags; misordered CLI arguments where the option's argument is missing; script-generated command lines that drop the value.","solutions":["Supply an explicit argument to the option: a package name, ':all:', ':none:', or comma-separated names.","Reorder arguments so the option's value is not another flag, e.g. 'pip install --all-releases :all: pkg'.","Check pip.conf / requirements files for an --all-releases/--only-final entry that omits its value."],"exampleFix":"# before\npip install --all-releases --only-final pkg\n\n# after\npip install --all-releases :all: pkg","handlingStrategy":"validation","validationCode":"def valid_release_arg(value: str) -> bool:\n    # --all-releases / --only-final require one non-flag argument\n    return not value.startswith(\"-\")\n\n# assert valid_release_arg(\":all:\")\n# assert not valid_release_arg(\"--only-final\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass a concrete value (package name, ':all:', ':none:', or comma list) to --all-releases/--only-final.","Order CLI args so the option's value is not another flag.","Audit generated command lines to ensure the value token is present."],"tags":["cli","release-control","argument-validation","command-error"],"backgroundTag":null,"analyzedSha":"f399c3718970b1b0e2478dac5296eb62679a9b86","analyzedAt":"2026-08-08T23:01:42.227Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}