{"record":{"id":"7737808616fb6fc0","repo":"XX-net/XX-Net","slug":"unzip-s-fail-r","errorCode":null,"errorMessage":"unzip %s fail:%r","messagePattern":"unzip (.+?) fail:%r","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"code/default/gae_proxy/local/download_gae_lib.py","lineNumber":123,"sourceCode":"    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)\n        return\n\n    try:\n        os.mkdir(extract_path)\n        with zipfile.ZipFile(dfn, \"r\") as dz:\n            dz.extractall(extract_path)\n            dz.close()\n        xlog.info(\"Extract %s to %s success.\", fn, extract_path)\n    except Exception as e:\n        xlog.warn(\"unzip %s fail:%r\", dfn, e)\n        shutil.rmtree(extract_path)\n        raise e\n    os.remove(dfn)\n\n\ndef check_lib_or_download():\n    lib_path = os.path.abspath(os.path.join(current_path, os.pardir, \"server\", \"lib\"))\n\n    if os.path.isdir(lib_path):\n        return True\n\n    download_unzip(\"https://github.com/XX-net/XX-Net/releases/download/3.15.0/lib.zip\", lib_path)","sourceCodeStart":105,"sourceCodeEnd":135,"githubUrl":"https://github.com/XX-net/XX-Net/blob/cfa5bc17b67676e467f37ec50766127e0ab5f0aa/code/default/gae_proxy/local/download_gae_lib.py#L105-L135","documentation":"zipfile extraction of the downloaded archive raised an exception; download_unzip removes the partial extract_path, re-raises, and the zip file is left/delete skipped. Usually paired with error 62/63 when the download was truncated or corrupted.","triggerScenarios":"zipfile.ZipFile(dfn).extractall() throws BadZipFile, CRC error, or OSError (permissions/disk full). Typically caused by a corrupted/truncated download that passed size checks or a wrong (HTML error page) file saved as .zip.","commonSituations":"Server returned an error page instead of the zip, proxy-modified content, disk full or permission denied during extraction.","solutions":["Delete the cached zip in download_path and retry the download","Verify the file is a valid zip (unzip -t file.zip); if it is HTML, fix the URL/network","Ensure disk space and write permissions on extract_path and download_path","Extract manually and restart"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import zipfile\ntry:\n    zipfile.ZipFile(dfn).testzip()\nexcept zipfile.BadZipFile:\n    os.remove(dfn)  # force re-download","typeGuard":null,"tryCatchPattern":"try:\n    download_unzip(url, path)\nexcept zipfile.BadZipFile:\n    # delete cached zip and retry once, else install manually\n    pass","preventionTips":["Validate zip integrity after download","Ensure disk space and permissions before extraction"],"tags":["zipfile","extraction","corrupt-download","gae-proxy"],"backgroundTag":"corrupt-archive-extraction","analyzedSha":"cfa5bc17b67676e467f37ec50766127e0ab5f0aa","analyzedAt":"2026-08-27T19:28:28.225Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}