{"id":"ff1fa5cc48cf7381","repo":"pypa/pip","slug":"options-outdated-and-uptodate-cannot-be-combin","errorCode":null,"errorMessage":"Options --outdated and --uptodate cannot be combined.","messagePattern":"Options --outdated and --uptodate cannot be combined\\.","errorType":"exception","errorClass":"CommandError","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/commands/list.py","lineNumber":177,"sourceCode":"        # Pass allow_yanked=False to ignore yanked versions.\n        selection_prefs = SelectionPreferences(\n            allow_yanked=False,\n            release_control=options.release_control,\n            format_control=options.format_control,\n            prefer_binary=options.prefer_binary,\n        )\n\n        return PackageFinder.create(\n            link_collector=link_collector,\n            selection_prefs=selection_prefs,\n            uploaded_prior_to=options.uploaded_prior_to,\n        )\n\n    def run(self, options: Values, args: list[str]) -> int:\n        cmdoptions.check_release_control_exclusive(options)\n\n        if options.outdated and options.uptodate:\n            raise CommandError(\"Options --outdated and --uptodate cannot be combined.\")\n\n        if options.outdated and options.list_format == \"freeze\":\n            raise CommandError(\n                \"List format 'freeze' cannot be used with the --outdated option.\"\n            )\n\n        cmdoptions.check_list_path_option(options)\n\n        packages: _ProcessedDists = [\n            cast(\"_DistWithLatestInfo\", d)\n            for d in get_environment(options.path).iter_installed_distributions(\n                local_only=options.local,\n                user_only=options.user,\n                editables_only=options.editable,\n                include_editables=options.include_editable,\n                skip=set(stdlib_pkgs),\n            )\n        ]","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/pypa/pip/blob/d7d0d0a39494e28ec1c407bd0680e4a4d1067791/src/pip/_internal/commands/list.py#L159-L195","documentation":"Raised as CommandError in ListCommand.run() at list.py:176-177 when both --outdated (-o) and --uptodate (-u) are passed. The two flags request opposite filters (packages that are behind vs. packages that are current), so combining them is logically meaningless and pip refuses rather than returning an empty or confusing result.","triggerScenarios":"Running 'pip list -o -u' or 'pip list --outdated --uptodate'. The check at list.py:176 fires when both booleans are True.","commonSituations":"Combining flags while exploring; scripting that naively passes both; copy-paste from different command snippets.","solutions":["Use only one of --outdated or --uptodate depending on which set you want.","If you want the full picture, run 'pip list' with neither flag and compare versions manually or via --format json.","Run two separate commands and merge results in your script."],"exampleFix":"# before\npip list --outdated --uptodate\n# after\npip list --outdated\n# or\npip list --uptodate","handlingStrategy":"validation","validationCode":"import sys\nif '--outdated' in sys.argv or '-o' in sys.argv:\n    if '--uptodate' in sys.argv or '-u' in sys.argv:\n        print('ERROR: --outdated and --uptodate are mutually exclusive', file=sys.stderr)\n        sys.exit(2)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass only one of --outdated / --uptodate.","If you need both sets, run two separate 'pip list' invocations."],"tags":["pip","list","cli-argument-conflict","outdated-uptodate"],"analyzedSha":"d7d0d0a39494e28ec1c407bd0680e4a4d1067791","analyzedAt":"2026-08-04T20:55:04.259Z","schemaVersion":2}