{"record":{"id":"d55663df38282c00","repo":"openai/whisper","slug":"model-name-not-found-available-models-availa","errorCode":null,"errorMessage":"Model {name} not found; available models = {available_models()}","messagePattern":"Model (.+?) not found; available models = (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"whisper/__init__.py","lineNumber":143,"sourceCode":"    -------\n    model : Whisper\n        The Whisper ASR model instance\n    \"\"\"\n\n    if device is None:\n        device = \"cuda\" if torch.cuda.is_available() else \"cpu\"\n    if download_root is None:\n        default = os.path.join(os.path.expanduser(\"~\"), \".cache\")\n        download_root = os.path.join(os.getenv(\"XDG_CACHE_HOME\", default), \"whisper\")\n\n    if name in _MODELS:\n        checkpoint_file = _download(_MODELS[name], download_root, in_memory)\n        alignment_heads = _ALIGNMENT_HEADS[name]\n    elif os.path.isfile(name):\n        checkpoint_file = open(name, \"rb\").read() if in_memory else name\n        alignment_heads = None\n    else:\n        raise RuntimeError(\n            f\"Model {name} not found; available models = {available_models()}\"\n        )\n\n    with (\n        io.BytesIO(checkpoint_file) if in_memory else open(checkpoint_file, \"rb\")\n    ) as fp:\n        kwargs = {\"weights_only\": True} if torch.__version__ >= \"1.13\" else {}\n        checkpoint = torch.load(fp, map_location=device, **kwargs)\n    del checkpoint_file\n\n    dims = ModelDimensions(**checkpoint[\"dims\"])\n    model = Whisper(dims)\n    model.load_state_dict(checkpoint[\"model_state_dict\"])\n\n    if alignment_heads is not None:\n        model.set_alignment_heads(alignment_heads)\n\n    return model.to(device)","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/openai/whisper/blob/5f86d1d86363843179951550570367b37c5d6f78/whisper/__init__.py#L125-L161","documentation":"whisper.load_model(name) only accepts (a) a key of the _MODELS registry (tiny, base, small, medium, large-v1/v2/v3, large-v3-turbo, turbo, and their .en variants) or (b) a path to an existing checkpoint file. Anything else raises RuntimeError listing the valid names.","triggerScenarios":"load_model('medium-en') (wrong separator, real name is 'medium.en'), load_model('whisper-large-v3'), or a relative path like load_model('models/base.pt') when the CWD is different — os.path.isfile(name) fails, so the name falls through to the error branch.","commonSituations":"Typos in model names (hyphen vs dot, missing .en), running a script from a different working directory with a relative checkpoint path, using a fine-tuned checkpoint path that does not exist yet, or assuming a model name from a different fork (e.g. faster-whisper/faster_distilrobust) exists here.","solutions":["Print valid names: python -c \"import whisper; print(whisper.available_models())\" and use one of those exactly","For a local checkpoint, pass an absolute path: os.path.abspath(path), and confirm it exists first","Check spelling of the .en variants — the separator is a dot ('base.en', not 'base-en')","If the checkpoint is on another machine/symlink, verify os.path.isfile() resolves to True from the same process/CWD"],"exampleFix":"# before\nmodel = whisper.load_model(\"medium-en\")  # RuntimeError: Model not found\n\n# after\nimport whisper, os\nname = \"medium.en\"  # or a real path:\n# name = os.path.abspath(\"checkpoints/finetuned.pt\")\nassert name in whisper.available_models() or os.path.isfile(name)\nmodel = whisper.load_model(name)","handlingStrategy":"type-guard","validationCode":"import os, whisper\n\ndef is_loadable_model(name: str) -> bool:\n    return name in whisper.available_models() or os.path.isfile(name)","typeGuard":"from typing import Literal\nModelName = Literal[\"tiny\", \"base\", \"small\", \"medium\", \"large-v1\", \"large-v2\", \"large-v3\", \"large-v3-turbo\", \"turbo\", \"tiny.en\", \"base.en\", \"small.en\", \"medium.en\"]\n\ndef is_model_name(v: str) -> \"TypeGuard[ModelName]\":\n    import whisper\n    return v in whisper.available_models()","tryCatchPattern":"try:\n    model = whisper.load_model(name)\nexcept RuntimeError as e:\n    if \"not found; available models\" in str(e):\n        raise ValueError(f\"bad model {name!r}; valid: {whisper.available_models()}\") from e\n    raise","preventionTips":["Derive model names from whisper.available_models() instead of hardcoding strings","Always os.path.abspath() local checkpoint paths before passing them","Pin the openai-whisper version so the model registry cannot change under you"],"tags":["model-loading","configuration","cli","filesystem"],"backgroundTag":null,"analyzedSha":"5f86d1d86363843179951550570367b37c5d6f78","analyzedAt":"2026-08-14T18:53:59.547Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}