XX-net/XX-Net · error
unzip %s fail:%r
Error message
unzip %s fail:%r
What it means
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.
Source
Thrown at code/default/gae_proxy/local/download_gae_lib.py:123
download_path = os.path.join(data_root, 'downloads')
if not os.path.isdir(download_path):
os.mkdir(download_path)
fn = url.split("/")[-1]
dfn = os.path.join(download_path, fn)
if not download_file(url, dfn):
xlog.warn("download file %s fail.", url)
return
try:
os.mkdir(extract_path)
with zipfile.ZipFile(dfn, "r") as dz:
dz.extractall(extract_path)
dz.close()
xlog.info("Extract %s to %s success.", fn, extract_path)
except Exception as e:
xlog.warn("unzip %s fail:%r", dfn, e)
shutil.rmtree(extract_path)
raise e
os.remove(dfn)
def check_lib_or_download():
lib_path = os.path.abspath(os.path.join(current_path, os.pardir, "server", "lib"))
if os.path.isdir(lib_path):
return True
download_unzip("https://github.com/XX-net/XX-Net/releases/download/3.15.0/lib.zip", lib_path)View on GitHub (pinned to cfa5bc17b6)
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
Defensive patterns
Strategy: try-catch
Validate before calling
import zipfile
try:
zipfile.ZipFile(dfn).testzip()
except zipfile.BadZipFile:
os.remove(dfn) # force re-download Try / catch
try:
download_unzip(url, path)
except zipfile.BadZipFile:
# delete cached zip and retry once, else install manually
pass Prevention
- Validate zip integrity after download
- Ensure disk space and permissions before extraction
When it happens
Trigger: 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.
Common situations: Server returned an error page instead of the zip, proxy-modified content, disk full or permission denied during extraction.
Related errors
AI-assisted analysis of XX-net/XX-Net@cfa5bc17b6 (2026-08-27).
Data as JSON: /api/errors/7737808616fb6fc0.
Report an issue: GitHub.