{"id":"7b15fdf2ab57dc6d","repo":"pypa/pip","slug":"too-many-arguments","errorCode":null,"errorMessage":"Too many arguments","messagePattern":"Too many arguments","errorType":"exception","errorClass":"CommandError","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/commands/cache.py","lineNumber":89,"sourceCode":"                \"Need an action (%s) to perform.\",\n                \", \".join(sorted(handler_map)),\n            )\n            return ERROR\n\n        action = args[0]\n\n        # Error handling happens here, not in the action-handlers.\n        try:\n            handler_map[action](options, args[1:])\n        except PipError as e:\n            logger.error(e.args[0])\n            return ERROR\n\n        return SUCCESS\n\n    def get_cache_dir(self, options: Values, args: list[str]) -> None:\n        if args:\n            raise CommandError(\"Too many arguments\")\n\n        logger.info(options.cache_dir)\n\n    def get_cache_info(self, options: Values, args: list[str]) -> None:\n        if args:\n            raise CommandError(\"Too many arguments\")\n\n        num_http_files = len(self._find_http_files(options))\n        num_packages = len(self._find_wheels(options, \"*\"))\n\n        http_cache_location = self._cache_dir(options, \"http-v2\")\n        old_http_cache_location = self._cache_dir(options, \"http\")\n        wheels_cache_location = self._cache_dir(options, \"wheels\")\n        http_cache_size = filesystem.format_size(\n            filesystem.directory_size(http_cache_location)\n            + filesystem.directory_size(old_http_cache_location)\n        )\n        wheels_cache_size = filesystem.format_directory_size(wheels_cache_location)","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/pypa/pip/blob/d7d0d0a39494e28ec1c407bd0680e4a4d1067791/src/pip/_internal/commands/cache.py#L71-L107","documentation":"Raised by 'pip cache dir' (CacheCommand.get_cache_dir) when extra positional arguments are passed. The dir subcommand only prints the cache directory path and accepts zero arguments; any trailing token is rejected with CommandError 'Too many arguments'.","triggerScenarios":"Running 'pip cache dir something' or 'pip cache dir /custom/path' - users mistakenly trying to set or query a specific cache path through the dir subcommand.","commonSituations":"Assuming 'pip cache dir <path>' sets the cache location (it does not - use --cache-dir or PIP_CACHE_DIR); autocomplete inserting a stray argument; chaining subcommands like 'pip cache dir info'.","solutions":["Drop the extra argument: 'pip cache dir' prints the current cache directory.","To change the cache location, use 'pip install --cache-dir <path> ...' or set PIP_CACHE_DIR.","If you wanted cache details, use 'pip cache info' instead."],"exampleFix":"// before\npip cache dir /tmp/mypycache\n// after\nPIP_CACHE_DIR=/tmp/mypycache pip cache dir","handlingStrategy":"validation","validationCode":"if extra_args:\n    raise SystemExit(\"'pip cache dir' takes no arguments; use --cache-dir or PIP_CACHE_DIR to change location\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember 'pip cache dir' only prints; set location via PIP_CACHE_DIR or --cache-dir.","Use 'pip cache -h' to confirm each subcommand's arity."],"tags":["pip","cache","cli","invalid-argument"],"analyzedSha":"d7d0d0a39494e28ec1c407bd0680e4a4d1067791","analyzedAt":"2026-08-04T20:55:04.259Z","schemaVersion":2}