{"record":{"id":"f5c82aae57fe628f","repo":"XX-net/XX-Net","slug":"unzip-s-fail-r-f5c82a","errorCode":null,"errorMessage":"unzip %s fail:%r","messagePattern":"unzip (.+?) fail:%r","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"code/default/launcher/update_from_github.py","lineNumber":308,"sourceCode":"    if checkhash:\n        hash_sum = get_hash_sum(xxnet_version)\n        if len(hash_sum) and hash_file_sum(xxnet_zip_file) != hash_sum:\n            progress[\"update_status\"] = \"Download Checksum Fail.\"\n            xlog.warn(\"downloaded xxnet zip checksum fail:%s\" % xxnet_zip_file)\n            raise Exception(\"downloaded xxnet zip checksum fail:%s\" % xxnet_zip_file)\n    else:\n        xlog.debug(\"skip checking downloaded file hash\")\n\n    xlog.info(\"update download %s finished.\", download_path)\n\n    xlog.info(\"update start unzip\")\n    progress[\"update_status\"] = \"Unziping\"\n    try:\n        with zipfile.ZipFile(xxnet_zip_file, \"r\") as dz:\n            dz.extractall(download_path)\n            dz.close()\n    except Exception as e:\n        xlog.warn(\"unzip %s fail:%r\", xxnet_zip_file, e)\n        progress[\"update_status\"] = \"Unzip Fail:%s\" % e\n        raise e\n    xlog.info(\"update finished unzip\")\n\n    overwrite(xxnet_version, xxnet_unzip_path)\n\n    os.remove(xxnet_zip_file)\n    shutil.rmtree(xxnet_unzip_path, ignore_errors=True)\n\n\ndef get_local_versions():\n    def get_folder_version(folder):\n        f = os.path.join(code_path, folder, \"version.txt\")\n        try:\n            with open(f) as fd:\n                content = fd.read()\n                p = re.compile(r'([0-9]+)\\.([0-9]+)\\.([0-9]+)')\n                m = p.match(content)","sourceCodeStart":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/XX-net/XX-Net/blob/cfa5bc17b67676e467f37ec50766127e0ab5f0aa/code/default/launcher/update_from_github.py#L290-L326","documentation":"Zip extraction of the downloaded release fails; zipfile raises (BadZipFile, IO/OSError), the handler logs it, sets progress['update_status'] to 'Unzip Fail' and re-raises, aborting the update.","triggerScenarios":"The downloaded file is not a valid zip (HTML error page saved as .zip), truncated zip, or disk-full/permission error writing extracted files.","commonSituations":"Mirror returned an error page; checksum step skipped (checkhash=0) letting a corrupt file through; disk full; path-length limits on Windows.","solutions":["Retry the full update so the zip re-downloads.","Keep checksum verification enabled (checkhash=1) to catch corrupt zips before unzip.","Inspect/unzip the file manually to confirm corruption; free disk space.","Delete the stale zip in the download path before retrying."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import zipfile\nif not zipfile.is_zipfile(zip_path):\n    os.remove(zip_path)\n    raise BadDownload(zip_path)","typeGuard":"def valid_zip(p):\n    import zipfile\n    return zipfile.is_zipfile(p)","tryCatchPattern":"try:\n    with zipfile.ZipFile(zip_path) as z: z.extractall(dest)\nexcept zipfile.BadZipFile:\n    os.remove(zip_path); retry_update()","preventionTips":["Keep checksum verification enabled to catch corrupt files pre-unzip.","Free disk space before extraction.","Don't reuse partially downloaded files."],"tags":["zip","update","corruption","extraction"],"backgroundTag":"bad-zip-file","analyzedSha":"cfa5bc17b67676e467f37ec50766127e0ab5f0aa","analyzedAt":"2026-08-27T19:28:28.225Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}