{"record":{"id":"0756cff919154178","repo":"invoke-ai/InvokeAI","slug":"more-than-one-model-found-with-name-name-base","errorCode":null,"errorMessage":"More than one model found with name {name}, base {base}, and type {type}","messagePattern":"More than one model found with name (.+?), base (.+?), and type (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/services/shared/invocation_context.py","lineNumber":576,"sourceCode":"        \"\"\"Load a model by its attributes.\n\n        Args:\n            name: Name of the model.\n            base: The models' base type, e.g. `BaseModelType.StableDiffusion1`, `BaseModelType.StableDiffusionXL`, etc.\n            type: Type of the model, e.g. `ModelType.Main`, `ModelType.Vae`, etc.\n            submodel_type: The type of submodel to load, e.g. `SubModelType.UNet`, `SubModelType.TextEncoder`, etc. Only main\n            models have submodels.\n\n        Returns:\n            An object representing the loaded model.\n        \"\"\"\n\n        configs = self._services.model_manager.store.search_by_attr(model_name=name, base_model=base, model_type=type)\n        if len(configs) == 0:\n            raise UnknownModelException(f\"No model found with name {name}, base {base}, and type {type}\")\n\n        if len(configs) > 1:\n            raise ValueError(f\"More than one model found with name {name}, base {base}, and type {type}\")\n\n        self._raise_if_external(configs[0])\n        message = f\"Loading model {name}\"\n        if submodel_type:\n            message += f\" ({submodel_type.value})\"\n        self._util.signal_progress(message)\n        return self._services.model_manager.load.load_model(\n            configs[0], submodel_type, user_id=self._data.queue_item.user_id\n        )\n\n    def offload_from_vram(self, identifier: Union[str, \"ModelIdentifierField\"]) -> int:\n        \"\"\"Move a model (and all of its submodels) from VRAM to RAM, freeing its VRAM but keeping it cached.\n\n        Use this when an invocation is done with a model for the rest of the run - e.g. a one-shot text encoder -\n        so the next, larger load does not have to compete with it for VRAM. The model stays in the RAM cache, so\n        a subsequent load only re-streams it back to VRAM rather than rebuilding it from disk.\n\n        Args:","sourceCodeStart":558,"sourceCodeEnd":594,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/services/shared/invocation_context.py#L558-L594","documentation":"Raised by load_by_attrs when the attribute search matches more than one model config. Because the API returns a single model, an ambiguous match is a ValueError. Distinguished from UnknownModelException (zero matches).","triggerScenarios":"Two or more installed models share the same name, base_model, and model_type — e.g. the same LoRA installed in two directories or imported twice from different paths.","commonSituations":"Duplicate model files in multiple configured model paths; re-importing a model that already exists; models directory containing copies; scan picked up the same model twice.","solutions":["Remove or rename the duplicate model so the (name, base, type) tuple is unique","Delete the duplicate model record via the model manager and rescan","Load by model key/ModelField instead of by attributes to avoid ambiguity"],"exampleFix":"// before\nmodel = ctx.models.load_by_attrs(name=\"MyLora\", base=BaseModelType.Sdxl, type=ModelType.LoRA)\n// after\ncandidates = ctx._services.model_manager.store.search_by_attr(model_name=\"MyLora\", base_model=BaseModelType.Sdxl, model_type=ModelType.LoRA)\nmodel = ctx.models.load(key=candidates[0].key)  # unique key, no ambiguity","handlingStrategy":"try-catch","validationCode":"configs = services.model_manager.store.search_by_attr(model_name=name, base_model=base, model_type=type)\nif len(configs) > 1:\n    keys = [c.key for c in configs]\n    raise RuntimeError(f\"ambiguous model {name!r}: {keys}; load by key instead\")","typeGuard":null,"tryCatchPattern":"try:\n    model = ctx.models.load_by_attrs(name=name, base=base, type=type)\nexcept ValueError as e:\n    if \"More than one model found\" in str(e):\n        logger.error(\"Duplicate model entries for %s; dedupe and rescan\", name)\n        model = None\n    else:\n        raise","preventionTips":["Avoid installing the same model file in multiple scanned directories","Remove duplicate model records via the Model Manager","Load by unique model key/ModelField when duplicates may exist"],"tags":["models","ambiguous","duplicates"],"backgroundTag":"ambiguous-model-lookup","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}