{"record":{"id":"a465cb47e5492162","repo":"deepinsight/insightface","slug":"model-file-model-name-not-found-in-downloaded","errorCode":null,"errorMessage":"Model file '{model_name}' not found in downloaded repository","messagePattern":"Model file '(.+?)' not found in downloaded repository","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"cpp-package/inspireface/python/inspireface/modules/utils/resource.py","lineNumber":133,"sourceCode":"            str: Path to the downloaded model file\n        \"\"\"\n        if not MODELSCOPE_AVAILABLE:\n            raise ImportError(\"ModelScope is not available. Please install it with: pip install modelscope\")\n            \n        print(f\"Downloading model '{model_name}' from ModelScope...\")\n        \n        try:\n            # Download specific model file from ModelScope\n            cache_dir = snapshot_download(\n                model_id=self.modelscope_model_id,\n                cache_dir=str(self.modelscope_cache_dir),\n                allow_file_pattern=[model_name]  # Only download the specific model file\n            )\n            \n            model_file_path = Path(cache_dir) / model_name\n            \n            if not model_file_path.exists():\n                raise FileNotFoundError(f\"Model file '{model_name}' not found in downloaded repository\")\n                \n            print(f\"ModelScope download completed: {model_file_path}\")\n            return str(model_file_path)\n            \n        except Exception as e:\n            raise RuntimeError(f\"Failed to download model from ModelScope: {e}\")\n\n    def get_model(self, name: str, re_download: bool = False, ignore_verification: bool = False) -> str:\n        \"\"\"\n        Get model path. Download if not exists or re_download is True.\n        \n        Args:\n            name: Model name\n            re_download: Force re-download if True\n            ignore_verification: Skip model hash verification if True\n            \n        Returns:\n            str: Full path to model file","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/deepinsight/insightface/blob/7fadd420c2351d0ffa8cac403421c1a3ed733365/cpp-package/inspireface/python/inspireface/modules/utils/resource.py#L115-L151","documentation":"After snapshot_download(..., allow_file_pattern=[model_name]) returns, _download_from_modelscope expects the requested file at cache_dir/model_name; if the model repository doesn't contain a file with that exact name, FileNotFoundError is raised. It usually means a wrong model name or a repo layout mismatch.","triggerScenarios":"Calling get_model(name) with a name whose mapped file doesn't exist in the ModelScope repo — typos, renamed upstream files, or case-sensitivity mismatches between the requested filename and the repo contents.","commonSituations":"Upstream ModelScope repo restructured/renamed model files; user passes a model name string that isn't in the local mapping (forwarded anyway in modelscope mode); locale/case differences in filenames.","solutions":["Check the ModelScope repo file listing and use the exact filename","If upstream renamed files, upgrade inspireface so _MODEL_LIST maps to current names, or pin a known-good modelscope snapshot revision","As a fallback, download the file manually and place it in the models cache dir, then call get_model with re_download=False"],"exampleFix":"# before\npath = resource.get_model('pikachu-v2')  # file not in repo\n# after — inspect repo files, use exact name\npath = resource.get_model('pikachu')","handlingStrategy":"validation","validationCode":"valid = list(resource._MODEL_LIST.keys())\nassert model_name in valid or (Path(cache_dir) / model_name).exists(), model_name","typeGuard":null,"tryCatchPattern":"try:\n    path = resource.get_model(name)\nexcept FileNotFoundError as e:\n    log.error('check repo file listing; names: %s', list(resource._MODEL_LIST))\n    raise","preventionTips":["Use names from the registry verbatim","Pin package + modelscope revisions so repo layout can't drift"],"tags":["download","modelscope","file-not-found","model"],"backgroundTag":"model-download-file-missing","analyzedSha":"7fadd420c2351d0ffa8cac403421c1a3ed733365","analyzedAt":"2026-08-28T15:44:01.850Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}