{"id":"a9bff1440165fbed","repo":"pypa/pip","slug":"incomplete-download","errorCode":"incomplete-download","errorMessage":"Download failed {retry_status}because not enough bytes were received ({download_status})","messagePattern":"Download failed (.+?)because not enough bytes were received \\((.+?)\\)","errorType":"exception","errorClass":"IncompleteDownloadError","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/network/download.py","lineNumber":273,"sourceCode":"\n            try:\n                resume_resp = self._http_get_resume(download, should_match=first_resp)\n                # Fallback: if the server responded with 200 (i.e., the file has\n                # since been modified or range requests are unsupported) or any\n                # other unexpected status, restart the download from the beginning.\n                must_restart = resume_resp.status_code != HTTPStatus.PARTIAL_CONTENT\n                if must_restart:\n                    download.reset_file()\n                    download.size = _get_http_response_size(resume_resp)\n                    first_resp = resume_resp\n                else:\n                    # If the resume request starts at the wrong location, fail\n                    # outright since the server is misbehaving.\n                    content_range = resume_resp.headers.get(\"Content-Range\", \"\")\n                    resumed_at = content_range.lower().partition(\"bytes \")[2]\n                    resumed_at = resumed_at.partition(\"-\")[0]\n                    if resumed_at and resumed_at != str(download.bytes_received):\n                        raise IncompleteDownloadError(download)\n\n                self._process_response(download, resume_resp)\n            except (\n                ConnectionFailedError,\n                ConnectionTimeoutError,\n                ProxyConnectionError,\n                SSLVerificationError,\n                ReadTimeoutError,\n                ProtocolError,\n                OSError,\n            ):\n                # The error handling here is tricky, a few notes:\n                #\n                # - The diagnostic connection errors are raised by our custom\n                #   requests.request() connection exception handler.\n                # - ProtocolError is raised by urllib3 when the returned data length\n                #   doesn't match the response Content-Length.\n                # - ReadTimeoutError / ProtocolError come straight from urllib3 (via","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/pypa/pip/blob/d7d0d0a39494e28ec1c407bd0680e4a4d1067791/src/pip/_internal/network/download.py#L255-L291","documentation":"Error \"Download failed {retry_status}because not enough bytes were received ({download_status})\" thrown in pypa/pip.","triggerScenarios":"Thrown at src/pip/_internal/network/download.py:273 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"d7d0d0a39494e28ec1c407bd0680e4a4d1067791","analyzedAt":"2026-08-04T20:55:04.259Z","schemaVersion":2}