XX-net/XX-Net · error

unzip %s fail:%r

Error message

unzip %s fail:%r

What it means

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.

Source

Thrown at code/default/launcher/update_from_github.py:308

    if checkhash:
        hash_sum = get_hash_sum(xxnet_version)
        if len(hash_sum) and hash_file_sum(xxnet_zip_file) != hash_sum:
            progress["update_status"] = "Download Checksum Fail."
            xlog.warn("downloaded xxnet zip checksum fail:%s" % xxnet_zip_file)
            raise Exception("downloaded xxnet zip checksum fail:%s" % xxnet_zip_file)
    else:
        xlog.debug("skip checking downloaded file hash")

    xlog.info("update download %s finished.", download_path)

    xlog.info("update start unzip")
    progress["update_status"] = "Unziping"
    try:
        with zipfile.ZipFile(xxnet_zip_file, "r") as dz:
            dz.extractall(download_path)
            dz.close()
    except Exception as e:
        xlog.warn("unzip %s fail:%r", xxnet_zip_file, e)
        progress["update_status"] = "Unzip Fail:%s" % e
        raise e
    xlog.info("update finished unzip")

    overwrite(xxnet_version, xxnet_unzip_path)

    os.remove(xxnet_zip_file)
    shutil.rmtree(xxnet_unzip_path, ignore_errors=True)


def get_local_versions():
    def get_folder_version(folder):
        f = os.path.join(code_path, folder, "version.txt")
        try:
            with open(f) as fd:
                content = fd.read()
                p = re.compile(r'([0-9]+)\.([0-9]+)\.([0-9]+)')
                m = p.match(content)

View on GitHub (pinned to cfa5bc17b6)

Solutions

  1. Retry the full update so the zip re-downloads.
  2. Keep checksum verification enabled (checkhash=1) to catch corrupt zips before unzip.
  3. Inspect/unzip the file manually to confirm corruption; free disk space.
  4. Delete the stale zip in the download path before retrying.
Defensive patterns

Strategy: validation

Validate before calling

import zipfile
if not zipfile.is_zipfile(zip_path):
    os.remove(zip_path)
    raise BadDownload(zip_path)

Type guard

def valid_zip(p):
    import zipfile
    return zipfile.is_zipfile(p)

Try / catch

try:
    with zipfile.ZipFile(zip_path) as z: z.extractall(dest)
except zipfile.BadZipFile:
    os.remove(zip_path); retry_update()

Prevention

When it happens

Trigger: The downloaded file is not a valid zip (HTML error page saved as .zip), truncated zip, or disk-full/permission error writing extracted files.

Common situations: Mirror returned an error page; checksum step skipped (checkhash=0) letting a corrupt file through; disk full; path-length limits on Windows.

Related errors


AI-assisted analysis of XX-net/XX-Net@cfa5bc17b6 (2026-08-27). Data as JSON: /api/errors/f5c82aae57fe628f. Report an issue: GitHub.