invoke-ai/InvokeAI · error · DuplicateModelException
More than one model matched the search criteria: base_model=
Error message
More than one model matched the search criteria: base_model='{base_model}', model_type='{model_type}', model_name='{model_name}'. What it means
model_info_by_name looks up a model by name/base/type via search_by_attr and requires exactly one match. When more than one installed model config matches all three criteria it raises DuplicateModelException, because it cannot disambiguate which record to return.
Source
Thrown at invokeai/app/services/model_records/model_records_base.py:300
If none of the optional filters are passed, will return all
models in the database.
"""
pass
def all_models(self) -> List[AnyModelConfig]:
"""Return all the model configs in the database."""
return self.search_by_attr()
def model_info_by_name(self, model_name: str, base_model: BaseModelType, model_type: ModelType) -> AnyModelConfig:
"""
Return information about a single model using its name, base type and model type.
If there are more than one model that match, raises a DuplicateModelException.
If no model matches, raises an UnknownModelException
"""
model_configs = self.search_by_attr(model_name=model_name, base_model=base_model, model_type=model_type)
if len(model_configs) > 1:
raise DuplicateModelException(
f"More than one model matched the search criteria: base_model='{base_model}', model_type='{model_type}', model_name='{model_name}'."
)
if len(model_configs) == 0:
raise UnknownModelException(
f"More than one model matched the search criteria: base_model='{base_model}', model_type='{model_type}', model_name='{model_name}'."
)
return model_configs[0]
View on GitHub (pinned to 0b6a024f2f)
Solutions
- Call search_by_attr yourself, list the duplicate keys, and delete one via del_model.
- Rename one of the duplicate models so names are unique.
- Uninstall the stale/duplicate copy through the Model Manager UI.
- Reference the model by its unique key instead of name where the API allows.
Example fix
# before
info = records.model_info_by_name('MyModel', BaseModelType.StableDiffusion1, ModelType.Main)
# after
configs = records.search_by_attr(model_name='MyModel', base_model=..., model_type=...)
for c in configs[1:]:
records.del_model(c.key)
info = records.model_info_by_name('MyModel', BaseModelType.StableDiffusion1, ModelType.Main) Defensive patterns
Strategy: try-catch
Validate before calling
configs = records.search_by_attr(model_name=name, base_model=base, model_type=mtype)
assert len(configs) <= 1, f"Duplicates present: {[c.key for c in configs]}" Try / catch
try:
info = records.model_info_by_name(name, base, mtype)
except DuplicateModelException as e:
configs = records.search_by_attr(model_name=name, base_model=base, model_type=mtype)
info = min(configs, key=lambda c: c.key) # or prompt user to disambiguate
log.warning('Duplicate models for %s; picking %s', name, info.key) Prevention
- Keep model names unique per base/type
- Delete stale duplicates after re-installing models
- Prefer referencing models by key, not name
- Periodically scan for duplicates with search_by_attr
When it happens
Trigger: Calling model_info_by_name (or API endpoints using it) where two installed models share the same name, base_model and model_type — e.g. the same model installed twice from different paths/sources, or after a reinstall that didn't dedupe.
Common situations: Re-importing the same checkpoint from a new folder without deleting the old entry; scanning multiple model directories containing copies of the same file; merged/fine-tuned variants saved under an identical name in the same base/type.
Related errors
- A model with path '{config.path}' is already installed
- The Anima ControlNet-LLLite model '{lllite_field.control_mod
- LoRA "{lora_key}" already applied to transformer.
- LoRA "{lora_key}" already applied to CLIP encoder.
- LoRA "{lora_key}" already applied to T5 encoder.
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/6b545f9176f79058.
Report an issue: GitHub.