openai/whisper · error · RuntimeError
{download_target} exists and is not a regular file
Error message
{download_target} exists and is not a regular file What it means
Raised by whisper._download() before fetching a model checkpoint. The path where the library wants to store the model (download_root/<model>.pt) already exists but is not a regular file — typically a directory, a named pipe, or a dangling special file. The library refuses to overwrite non-file entries to avoid destroying data or writing into a directory.
Source
Thrown at whisper/__init__.py:61
"medium.en": b"ABzY8usPae0{>%R7<zz_OvQ{)4kMa0BMw6u5rT}kRKX;$NfYBv00*Hl@qhsU00",
"medium": b"ABzY8B0Jh+0{>%R7}kK1fFL7w6%<-Pf*t^=N)Qr&0RR9",
"large-v1": b"ABzY8r9j$a0{>%R7#4sLmoOs{s)o3~84-RPdcFk!JR<kSfC2yj",
"large-v2": b"ABzY8zd+h!0{>%R7=D0pU<_bnWW*tkYAhobTNnu$jnkEkXqp)j;w1Tzk)UH3X%SZd&fFZ2fC2yj",
"large-v3": b"ABzY8gWO1E0{>%R7(9S+Kn!D~%ngiGaR?*L!iJG9p-nab0JQ=-{D1-g00",
"large": b"ABzY8gWO1E0{>%R7(9S+Kn!D~%ngiGaR?*L!iJG9p-nab0JQ=-{D1-g00",
"large-v3-turbo": b"ABzY8j^C+e0{>%RARaKHP%t(lGR*)0g!tONPyhe`",
"turbo": b"ABzY8j^C+e0{>%RARaKHP%t(lGR*)0g!tONPyhe`",
}
def _download(url: str, root: str, in_memory: bool) -> Union[bytes, str]:
os.makedirs(root, exist_ok=True)
expected_sha256 = url.split("/")[-2]
download_target = os.path.join(root, os.path.basename(url))
if os.path.exists(download_target) and not os.path.isfile(download_target):
raise RuntimeError(f"{download_target} exists and is not a regular file")
if os.path.isfile(download_target):
with open(download_target, "rb") as f:
model_bytes = f.read()
if hashlib.sha256(model_bytes).hexdigest() == expected_sha256:
return model_bytes if in_memory else download_target
else:
warnings.warn(
f"{download_target} exists, but the SHA256 checksum does not match; re-downloading the file"
)
with urllib.request.urlopen(url) as source, open(download_target, "wb") as output:
with tqdm(
total=int(source.info().get("Content-Length")),
ncols=80,
unit="iB",
unit_scale=True,
unit_divisor=1024,View on GitHub (pinned to 5f86d1d863)
Solutions
- Inspect the path: ls -la ~/.cache/whisper/ and check what <model>.pt actually is
- If it is a directory containing the checkpoint, move the .pt file out of it or point load_model's download_root at the correct directory
- Remove or rename the offending directory: rm -rf ~/.cache/whisper/<model>.pt (after confirming it holds nothing valuable), then retry load_model
- Pass an explicit download_root to whisper.load_model pointing at an empty, writable directory
Example fix
# before
# ~/.cache/whisper/base.pt is a directory -> RuntimeError
model = whisper.load_model("base")
# after
import os, shutil
p = os.path.expanduser("~/.cache/whisper/base.pt")
if os.path.exists(p) and not os.path.isfile(p):
shutil.rmtree(p) # or move real checkpoint out first
model = whisper.load_model("base") Defensive patterns
Strategy: validation
Validate before calling
import os
def safe_download_root_ok(root: str, model: str) -> bool:
target = os.path.join(root, f"{model}.pt")
return not os.path.exists(target) or os.path.isfile(target) Try / catch
try:
model = whisper.load_model(name, download_root=root)
except RuntimeError as e:
if "exists and is not a regular file" in str(e):
# inspect/remove the offending path, then retry once with a clean root
raise Prevention
- Pre-create the download_root yourself and assert it contains only *.pt regular files before load_model
- Never name directories after model files; keep checkpoints flat inside the cache dir
- In containers, mount the whisper cache as a volume and verify its layout in the entrypoint
When it happens
Trigger: Calling whisper.load_model('base') (or _download directly) when ~/.cache/whisper/base.pt (or $XDG_CACHE_HOME/whisper/base.pt, or a custom download_root) exists as a directory; e.g. someone previously ran 'mkdir -p ~/.cache/whisper/base.pt' or a bad symlink points to a directory.
Common situations: CI containers or shared servers where cache dirs were pre-created with wrong structure; users who unzipped a model into a folder named like the .pt file; symlinks from a shared model store pointing at a directory; a failed earlier tool that created a directory instead of a file.
Related errors
- Model {name} not found; available models = {available_models
- Model has been downloaded but the SHA256 checksum does not n
- Language {language} not found in tokenizer.
- Unsupported language: {language}
- model should be one of {available_models()} or path to a mod
AI-assisted analysis of openai/whisper@5f86d1d863 (2026-08-14).
Data as JSON: /api/errors/2e1dfbdfe89d5a93.
Report an issue: GitHub.