{"record":{"id":"04eb7b5fbaad6290","repo":"deepinsight/insightface","slug":"model-name-not-found-available-models-list","errorCode":null,"errorMessage":"Model '{name}' not found. Available models: {list(self._MODEL_LIST.keys())}","messagePattern":"Model '(.+?)' not found\\. Available models: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"cpp-package/inspireface/python/inspireface/modules/utils/resource.py","lineNumber":163,"sourceCode":"        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\n        \"\"\"\n        # Check global OSS setting first, then instance setting\n        use_oss = USE_OSS_DOWNLOAD\n        use_modelscope_actual = self.use_modelscope and not use_oss\n        \n        # Use ModelScope download if enabled and OSS is not forced\n        if use_modelscope_actual:\n            return self._download_from_modelscope_with_cache(name, re_download)\n            \n        # Original download logic for backwards compatibility\n        if name not in self._MODEL_LIST:\n            raise ValueError(f\"Model '{name}' not found. Available models: {list(self._MODEL_LIST.keys())}\")\n\n        model_info = self._MODEL_LIST[name]\n        model_file = self.models_dir / model_info[\"filename\"]\n        downloading_flag = model_file.with_suffix('.downloading')\n        \n        # Check if model exists and is complete\n        if model_file.exists() and not downloading_flag.exists() and not re_download:\n            if ignore_verification:\n                print(f\"Warning: Model verification skipped for '{name}' as requested.\")\n                return str(model_file)\n                \n            current_hash = get_file_hash_sha256(model_file)\n            if current_hash == model_info[\"md5\"]:\n                return str(model_file)\n            else:\n                print(f\"Model file hash mismatch for '{name}'. Re-downloading...\")\n\n        # Start download","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/deepinsight/insightface/blob/7fadd420c2351d0ffa8cac403421c1a3ed733365/cpp-package/inspireface/python/inspireface/modules/utils/resource.py#L145-L181","documentation":"In the legacy (non-ModelScope) download path, get_model looks up name in the static _MODEL_LIST registry; an unknown key raises ValueError listing all valid model names. This is pure input validation before any file or network access happens.","triggerScenarios":"Calling resource.get_model(name) in OSS mode with a string that isn't a key of _MODEL_LIST (typo, wrong casing, or a model removed/renamed in this version).","commonSituations":"Upgrading inspireface and re-running old scripts whose model names changed; guessing names like 'Pikachu' vs 'pikachu'; copy-pasting names from outdated docs.","solutions":["Use one of the names printed in the error message itself (list(self._MODEL_LIST.keys()))","Print the registry to discover valid names: inspect resource._MODEL_LIST at runtime","If you need a newer/renamed model, upgrade the inspireface package"],"exampleFix":"# before\npath = resource.get_model('Pikachu')\n# after\nvalid = list(resource._MODEL_LIST)\nprint(valid)  # see exact keys\npath = resource.get_model(valid[0])","handlingStrategy":"validation","validationCode":"valid = list(resource._MODEL_LIST.keys())\nassert name in valid, f'{name!r} not in {valid}'","typeGuard":"def is_known_model(resource, name: str) -> bool:\n    return name in resource._MODEL_LIST","tryCatchPattern":"try:\n    path = resource.get_model(name)\nexcept ValueError:\n    name = sorted(resource._MODEL_LIST)[0]  # pick a valid model\n    path = resource.get_model(name)","preventionTips":["Derive model names from the registry at runtime instead of hardcoding strings","Re-check valid names after upgrading inspireface"],"tags":["validation","model-name","registry","inspireface"],"backgroundTag":"unknown-model-name","analyzedSha":"7fadd420c2351d0ffa8cac403421c1a3ed733365","analyzedAt":"2026-08-28T15:44:01.850Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}