{"record":{"id":"828576d3a0060a5e","repo":"XX-net/XX-Net","slug":"download-s-to-s-fail-r","errorCode":null,"errorMessage":"download %s to %s fail:%r","messagePattern":"download (.+?) to (.+?) fail:%r","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"code/default/gae_proxy/local/download_gae_lib.py","lineNumber":95,"sourceCode":"                        if not chunk_len:\n                            break\n\n                        chunk = req.read(chunk_len)\n                        if not chunk:\n                            break\n                        fp.write(chunk)\n                        downloaded += len(chunk)\n                        left -= len(chunk)\n\n            if downloaded != file_size:\n                xlog.warn(\"download size:%d, need size:%d, download fail.\", downloaded, file_size)\n                os.remove(filename)\n                continue\n            else:\n                xlog.info(\"download %s to %s success.\", org_url, filename)\n                return True\n        except Exception as e:\n            xlog.warn(\"download %s to %s fail:%r\", org_url, filename, e)\n            continue\n    xlog.warn(\"download %s fail\", org_url)\n\n\ndef download_unzip(url, extract_path):\n    if os.path.isdir(extract_path):\n        return True\n\n    data_root = os.path.join(top_path, 'data')\n    download_path = os.path.join(data_root, 'downloads')\n    if not os.path.isdir(download_path):\n        os.mkdir(download_path)\n\n    fn = url.split(\"/\")[-1]\n    dfn = os.path.join(download_path, fn)\n\n    if not download_file(url, dfn):\n        xlog.warn(\"download file %s fail.\", url)","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/XX-net/XX-Net/blob/cfa5bc17b67676e467f37ec50766127e0ab5f0aa/code/default/gae_proxy/local/download_gae_lib.py#L77-L113","documentation":"Wrapped exception from a single download attempt inside download_file's retry loop; the exception object is included via %r. The loop then retries; only exhaustion of retries surfaces as a hard failure to the caller.","triggerScenarios":"Any exception during urlopen/read/write of one attempt: DNS failure, TLS error, timeout, disk write error, connection reset by the GAE front IP.","commonSituations":"No internet, firewall blocking Google IPs, TLS interception, read-only or full disk for the temp file, IPv6 issues.","solutions":["Read the %r exception detail to identify the root cause (DNS/TLS/timeout/disk)","Test connectivity to the download host directly (curl the same URL)","Free up disk space / fix permissions in the download directory","If persistent, download the archive manually and extract it to the expected path"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    download_file(url, fn)\nexcept Exception as e:\n    log.warning('download failed: %r', e)  # already retried internally; backoff and retry later","preventionTips":["Verify outbound HTTPS works before launching","Whitelist python in firewall/AV"],"tags":["download","exception","network","gae-proxy"],"backgroundTag":"download-request-failed","analyzedSha":"cfa5bc17b67676e467f37ec50766127e0ab5f0aa","analyzedAt":"2026-08-27T19:28:28.225Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}