XX-net/XX-Net · warning

download %s sha1 wrong

Error message

download %s sha1 wrong

What it means

After downloading a module package, the computed SHA-1 of the local file does not match the sha1 published in the update manifest for that version. The file is treated as corrupt/truncated and this URL candidate is skipped (continue).

Source

Thrown at code/default/launcher/update.py:191

    if not os.path.isdir(download_path):
        os.mkdir(download_path)

    try:
        for source in update_dict["modules"][module]["versions"][new_version]["sources"]:
            url = source["url"]
            filename = module + "-" + new_version + ".zip"

            file_path = os.path.join(download_path, filename)

            if os.path.isfile(file_path) and sha1_file(file_path) == update_dict["modules"][module]["versions"][new_version]["sha1"]:
                pass
            elif not download_file(url, file_path):
                xlog.warn("download %s fail", url)
                continue

            sha1 = sha1_file(file_path)
            if update_dict["modules"][module]["versions"][new_version]["sha1"] != sha1:
                xlog.warn("download %s sha1 wrong", url)
                continue

            module_path = os.path.abspath(os.path.join(current_path, os.pardir, os.pardir, module))
            if not os.path.isdir(module_path):
                os.mkdir(module_path)

            version_path = os.path.join(module_path, new_version)
            if os.path.isdir(version_path):
                xlog.error("module dir exist:%s, download exist.", version_path)
                return

            with zipfile.ZipFile(file_path, "r") as dz:
                dz.extractall(module_path)
                dz.close()

            import shutil
            unzip_path = os.path.abspath(os.path.join(module_path, module + "-" + new_version))
            tag_path = os.path.abspath(os.path.join(module_path, new_version))

View on GitHub (pinned to cfa5bc17b6)

Solutions

  1. Delete the cached file at the logged path so it is re-downloaded fresh
  2. Retry the update on a stable connection
  3. If it persists, the mirror may serve stale content — wait for manifest/mirror sync or switch update source/rule in config
  4. Verify manually: sha1sum <file> vs the sha1 in the update manifest
Defensive patterns

Strategy: validation

Validate before calling

import hashlib
def sha1_file(p):
    h = hashlib.sha1()
    with open(p,'rb') as f:
        for chunk in iter(lambda: f.read(1<<20), b''):
            h.update(chunk)
    return h.hexdigest()
assert sha1_file(file_path) == expected_sha1, 'corrupt download; delete and retry'

Prevention

When it happens

Trigger: download_module computes sha1_file(file_path) and compares it to update_dict['modules'][module]['versions'][new_version]['sha1']; any mismatch (partial download, changed file from a previous run, manifest updated mid-flight) triggers it.

Common situations: Interrupted download left a stale/partial file; server served an error page or different content; manifest lists a new sha1 while an old cached file with the same name exists.

Related errors


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