deezer/spleeter · error · IOError

Downloaded file is corrupted, please retry

Error message

Downloaded file is corrupted, please retry

What it means

After downloading a model archive, download() computes the file's SHA checksum and compares it to the expected checksum from the remote index; a mismatch raises IOError. It means the transfer produced bytes that do not match what the publisher recorded, so the archive is not trusted and is not extracted. This is a deliberate integrity guard against truncated or tampered downloads.

Source

Thrown at spleeter/model/provider/github.py:157

                Path of the directory to save model into.
        """
        url: str = "/".join(
            (self._host, self._repository, self.RELEASE_PATH, self._release, name)
        )
        url = f"{url}.tar.gz"
        logger.info(f"Downloading model archive {url}")
        with httpx.Client(http2=True) as client:
            with client.stream("GET", url) as response:
                response.raise_for_status()
                archive = NamedTemporaryFile(delete=False)
                try:
                    with archive as stream:
                        for chunk in response.iter_raw():
                            stream.write(chunk)
                    logger.info("Validating archive checksum")
                    checksum: str = compute_file_checksum(archive.name)
                    if checksum != self.checksum(name):
                        raise IOError("Downloaded file is corrupted, please retry")
                    logger.info(f"Extracting downloaded {name} archive")
                    with tarfile.open(name=archive.name) as tar:
                        tar.extractall(path=path)
                finally:
                    os.unlink(archive.name)
        logger.info(f"{name} model file(s) extracted")

View on GitHub (pinned to c8854001ac)

Solutions

  1. Simply retry the download — transient truncation is the most common cause
  2. Clear any proxy/CDN cache or disable a middle-box that may serve a stale archive, then retry
  3. Confirm disk space is sufficient for the archive before downloading
  4. If it persists, check that your spleeter version's model URL and checksum index are in sync; upgrade spleeter or pin a release where archive and checksum match

Example fix

// before
separator = Separator('spleeter:2stems')  # flaky network -> IOError corrupted
// after
import time
for attempt in range(3):
    try:
        separator = Separator('spleeter:2stems')
        break
    except IOError as e:
        if 'corrupted' not in str(e) or attempt == 2:
            raise
        time.sleep(2)
Defensive patterns

Strategy: retry

Validate before calling

import os

assert os.path.getfreebytes(path if hasattr(os.path, 'getfreebytes') else '.') > 500 * 1024 * 1024  # ensure disk space for the archive

Type guard

import hashlib

def sha256_matches(file_path: str, expected: str) -> bool:
    h = hashlib.sha256()
    with open(file_path, 'rb') as f:
        for chunk in iter(lambda: f.read(1 << 20), b''):
            h.update(chunk)
    return h.hexdigest() == expected

Try / catch

for attempt in range(3):
    try:
        provider.download(name, path)
        break
    except IOError as e:
        if 'corrupted' not in str(e):
            raise
        if attempt == 2:
            raise RuntimeError('Model download corrupted after 3 attempts; check network/proxy') from e

Prevention

When it happens

Trigger: Calling download(name, path) when the HTTP transfer is truncated (dropped connection mid iter_raw), a proxy/mirror serves a modified archive, or the remote archive was updated without updating the checksum index (or vice versa).

Common situations: Flaky Wi-Fi or CI network interrupting large model downloads; corporate proxies or CDN caches serving stale artifacts; spleeter version mismatch where the archive at the URL was replaced but the index still holds the old checksum; disk-full conditions silently shortening the written file.

Related errors


AI-assisted analysis of deezer/spleeter@c8854001ac (2026-08-28). Data as JSON: /api/errors/48d88fafdb5378c8. Report an issue: GitHub.