XingangPan/DragGAN · error · IOError

No data received

Error message

No data received

What it means

Raised inside dnnlib.util.open_url when a download request completes with HTTP 200 but the response body is empty (len(res.content) == 0). It is wrapped in a retry loop (num_attempts, default 10), so it signals that the URL returned no bytes at all — typically a dead link, a redirect that serves nothing, or a transient server failure. After exhausting attempts it propagates as an IOError to the caller.

Source

Thrown at dnnlib/util.py:449

    url_md5 = hashlib.md5(url.encode("utf-8")).hexdigest()
    if cache:
        cache_files = glob.glob(os.path.join(cache_dir, url_md5 + "_*"))
        if len(cache_files) == 1:
            filename = cache_files[0]
            return filename if return_filename else open(filename, "rb")

    # Download.
    url_name = None
    url_data = None
    with requests.Session() as session:
        if verbose:
            print("Downloading %s ..." % url, end="", flush=True)
        for attempts_left in reversed(range(num_attempts)):
            try:
                with session.get(url) as res:
                    res.raise_for_status()
                    if len(res.content) == 0:
                        raise IOError("No data received")

                    if len(res.content) < 8192:
                        content_str = res.content.decode("utf-8")
                        if "download_warning" in res.headers.get("Set-Cookie", ""):
                            links = [html.unescape(link) for link in content_str.split('"') if "export=download" in link]
                            if len(links) == 1:
                                url = requests.compat.urljoin(url, links[0])
                                raise IOError("Google Drive virus checker nag")
                        if "Google Drive - Quota exceeded" in content_str:
                            raise IOError("Google Drive download quota exceeded -- please try again later")

                    match = re.search(r'filename="([^"]*)"', res.headers.get("Content-Disposition", ""))
                    url_name = match[1] if match else url
                    url_data = res.content
                    if verbose:
                        print(" done")
                    break
            except KeyboardInterrupt:

View on GitHub (pinned to 336f120ce1)

Solutions

  1. Retry the download — open_url already retries internally up to num_attempts; simply re-run the command
  2. Verify the URL returns data: curl -sL <url> | wc -c; fix typos or use the official URL list
  3. Download the file manually (browser/wget) and pass the local file path instead of the URL
  4. Pass num_attempts larger, or context_kwargs={'num_attempts': 20} to be more resilient
  5. Check corporate proxy/firewall settings if all downloads come back empty

Example fix

# before
with dnnlib.open_url('https://host/model.pkl') as f: data = f.read()

# after (local file avoids the network path)
# wget https://host/model.pkl
with open('model.pkl','rb') as f: data = f.read()
Defensive patterns

Strategy: retry

Validate before calling

import requests
res = requests.get(url, stream=True)
if res.status_code == 200 and len(res.content) == 0:
    raise IOError('URL returns empty body — fix the URL before calling open_url')

Try / catch

try:
    with dnnlib.open_url(url) as f: data = f.read()
except IOError as e:
    if 'No data received' in str(e):
        # retries already exhausted; fall back to local file / different mirror
        ...

Prevention

When it happens

Trigger: Calling open_url (or load_network_pickle / gen_images with a network URL) where the server returns 200 with an empty body; passing an incorrect URL that points to a zero-length resource; intermittent hosting outages of the pretrained-weight hosts.

Common situations: Downloading official StyleGAN2-ADA pickle files from nvlabs-fi-cdn.nvidia.com or host.robots.ox.ac.uk when the mirror is flaky; typos in the URL passed to open_url; corporate proxies returning empty responses.

Related errors


AI-assisted analysis of XingangPan/DragGAN@336f120ce1 (2026-08-27). Data as JSON: /api/errors/40e7c68c526d438d. Report an issue: GitHub.