{"record":{"id":"1eda16d4818b59c2","repo":"openai/whisper","slug":"model-has-been-downloaded-but-the-sha256-checksum","errorCode":null,"errorMessage":"Model has been downloaded but the SHA256 checksum does not not match. Please retry loading the model.","messagePattern":"Model has been downloaded but the SHA256 checksum does not not match\\. Please retry loading the model\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"whisper/__init__.py","lineNumber":91,"sourceCode":"    with urllib.request.urlopen(url) as source, open(download_target, \"wb\") as output:\n        with tqdm(\n            total=int(source.info().get(\"Content-Length\")),\n            ncols=80,\n            unit=\"iB\",\n            unit_scale=True,\n            unit_divisor=1024,\n        ) as loop:\n            while True:\n                buffer = source.read(8192)\n                if not buffer:\n                    break\n\n                output.write(buffer)\n                loop.update(len(buffer))\n\n    model_bytes = open(download_target, \"rb\").read()\n    if hashlib.sha256(model_bytes).hexdigest() != expected_sha256:\n        raise RuntimeError(\n            \"Model has been downloaded but the SHA256 checksum does not not match. Please retry loading the model.\"\n        )\n\n    return model_bytes if in_memory else download_target\n\n\ndef available_models() -> List[str]:\n    \"\"\"Returns the names of available models\"\"\"\n    return list(_MODELS.keys())\n\n\ndef load_model(\n    name: str,\n    device: Optional[Union[str, torch.device]] = None,\n    download_root: str = None,\n    in_memory: bool = False,\n) -> Whisper:\n    \"\"\"","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/openai/whisper/blob/5f86d1d86363843179951550570367b37c5d6f78/whisper/__init__.py#L73-L109","documentation":"After downloading a checkpoint, whisper verifies the file's SHA256 against the hash embedded in the OpenAI URL. If the freshly downloaded bytes do not hash to the expected value, the download is considered corrupt/truncated and a RuntimeError is raised. (Note the message contains a typo: 'does not not match'.)","triggerScenarios":"A network layer truncates or alters the download: flaky connection, an HTTP proxy that injects an error page, a corporate MITM, disk full during write, or a partially flushed read of download_target immediately after the loop closes. Raised on the second phase of _download(), after the full byte stream was written.","commonSituations":"Unstable Wi-Fi/VPN, docker containers with small tmpfs at the cache path, CI runners behind authenticated proxies, or cloud function execution environments (AWS Lambda) where /tmp is size-limited and the large-v3 checkpoint gets cut off.","solutions":["Delete the partial file and retry: rm ~/.cache/whisper/<model>.pt && rerun load_model","Verify the file size against the published model size; if truncated, download manually with curl/wget --continue to the cache path and retry","Check disk space at the cache location (df -h ~/.cache) and free space or move download_root elsewhere","If behind a proxy, bypass it or configure HTTPS_PROXY correctly so the raw bytes pass through unmodified"],"exampleFix":"# before\nmodel = whisper.load_model(\"large-v3\")  # RuntimeError: checksum does not match\n\n# after\nimport os, urllib.request, whisper\nroot = os.path.expanduser(\"~/.cache/whisper\")\ntarget = os.path.join(root, \"large-v3.pt\")\nif os.path.exists(target):\n    os.remove(target)  # drop corrupt partial download\nmodel = whisper.load_model(\"large-v3\")  # re-downloads cleanly","handlingStrategy":"retry","validationCode":"import hashlib, os, urllib.parse\n\ndef verify_cached(root, url):\n    target = os.path.join(root, os.path.basename(url))\n    expected = url.split(\"/\")[-2]\n    if os.path.isfile(target):\n        return hashlib.sha256(open(target, \"rb\").read()).hexdigest() == expected\n    return None  # not downloaded yet","typeGuard":null,"tryCatchPattern":"for attempt in range(3):\n    try:\n        model = whisper.load_model(name)\n        break\n    except RuntimeError as e:\n        if \"SHA256\" in str(e) and attempt < 2:\n            os.remove(os.path.join(cache_root, f\"{name}.pt\"))\n            continue\n        raise","preventionTips":["Run load_model once in a build/provisioning step and cache the verified .pt artifact","Ensure the cache volume has free space larger than the checkpoint (large-v3 is ~3 GB)","Verify the SHA256 yourself after manual downloads instead of relying on the in-code check"],"tags":["network","model-download","checksum","retry"],"backgroundTag":null,"analyzedSha":"5f86d1d86363843179951550570367b37c5d6f78","analyzedAt":"2026-08-14T18:53:59.547Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}