{"record":{"id":"f0092ca3dc1bb0d1","repo":"XX-net/XX-Net","slug":"download-s-sha1-wrong","errorCode":null,"errorMessage":"download %s sha1 wrong","messagePattern":"download (.+?) sha1 wrong","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"code/default/launcher/update.py","lineNumber":191,"sourceCode":"    if not os.path.isdir(download_path):\n        os.mkdir(download_path)\n\n    try:\n        for source in update_dict[\"modules\"][module][\"versions\"][new_version][\"sources\"]:\n            url = source[\"url\"]\n            filename = module + \"-\" + new_version + \".zip\"\n\n            file_path = os.path.join(download_path, filename)\n\n            if os.path.isfile(file_path) and sha1_file(file_path) == update_dict[\"modules\"][module][\"versions\"][new_version][\"sha1\"]:\n                pass\n            elif not download_file(url, file_path):\n                xlog.warn(\"download %s fail\", url)\n                continue\n\n            sha1 = sha1_file(file_path)\n            if update_dict[\"modules\"][module][\"versions\"][new_version][\"sha1\"] != sha1:\n                xlog.warn(\"download %s sha1 wrong\", url)\n                continue\n\n            module_path = os.path.abspath(os.path.join(current_path, os.pardir, os.pardir, module))\n            if not os.path.isdir(module_path):\n                os.mkdir(module_path)\n\n            version_path = os.path.join(module_path, new_version)\n            if os.path.isdir(version_path):\n                xlog.error(\"module dir exist:%s, download exist.\", version_path)\n                return\n\n            with zipfile.ZipFile(file_path, \"r\") as dz:\n                dz.extractall(module_path)\n                dz.close()\n\n            import shutil\n            unzip_path = os.path.abspath(os.path.join(module_path, module + \"-\" + new_version))\n            tag_path = os.path.abspath(os.path.join(module_path, new_version))","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/XX-net/XX-Net/blob/cfa5bc17b67676e467f37ec50766127e0ab5f0aa/code/default/launcher/update.py#L173-L209","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Delete the cached file at the logged path so it is re-downloaded fresh","Retry the update on a stable connection","If it persists, the mirror may serve stale content — wait for manifest/mirror sync or switch update source/rule in config","Verify manually: sha1sum <file> vs the sha1 in the update manifest"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import hashlib\ndef sha1_file(p):\n    h = hashlib.sha1()\n    with open(p,'rb') as f:\n        for chunk in iter(lambda: f.read(1<<20), b''):\n            h.update(chunk)\n    return h.hexdigest()\nassert sha1_file(file_path) == expected_sha1, 'corrupt download; delete and retry'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Delete partially downloaded files before re-updating","Download to a temp file and rename only after checksum passes","Retry on stable connections when checksums mismatch"],"tags":["download","sha1","checksum","integrity"],"backgroundTag":"checksum-mismatch","analyzedSha":"cfa5bc17b67676e467f37ec50766127e0ab5f0aa","analyzedAt":"2026-08-27T19:28:28.225Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}