invoke-ai/InvokeAI · error · ValueError

More than one model found with name {name}, base {base}, and

Error message

More than one model found with name {name}, base {base}, and type {type}

What it means

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).

Source

Thrown at invokeai/app/services/shared/invocation_context.py:576

        """Load a model by its attributes.

        Args:
            name: Name of the model.
            base: The models' base type, e.g. `BaseModelType.StableDiffusion1`, `BaseModelType.StableDiffusionXL`, etc.
            type: Type of the model, e.g. `ModelType.Main`, `ModelType.Vae`, etc.
            submodel_type: The type of submodel to load, e.g. `SubModelType.UNet`, `SubModelType.TextEncoder`, etc. Only main
            models have submodels.

        Returns:
            An object representing the loaded model.
        """

        configs = self._services.model_manager.store.search_by_attr(model_name=name, base_model=base, model_type=type)
        if len(configs) == 0:
            raise UnknownModelException(f"No model found with name {name}, base {base}, and type {type}")

        if len(configs) > 1:
            raise ValueError(f"More than one model found with name {name}, base {base}, and type {type}")

        self._raise_if_external(configs[0])
        message = f"Loading model {name}"
        if submodel_type:
            message += f" ({submodel_type.value})"
        self._util.signal_progress(message)
        return self._services.model_manager.load.load_model(
            configs[0], submodel_type, user_id=self._data.queue_item.user_id
        )

    def offload_from_vram(self, identifier: Union[str, "ModelIdentifierField"]) -> int:
        """Move a model (and all of its submodels) from VRAM to RAM, freeing its VRAM but keeping it cached.

        Use this when an invocation is done with a model for the rest of the run - e.g. a one-shot text encoder -
        so the next, larger load does not have to compete with it for VRAM. The model stays in the RAM cache, so
        a subsequent load only re-streams it back to VRAM rather than rebuilding it from disk.

        Args:

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Remove or rename the duplicate model so the (name, base, type) tuple is unique
  2. Delete the duplicate model record via the model manager and rescan
  3. Load by model key/ModelField instead of by attributes to avoid ambiguity

Example fix

// before
model = ctx.models.load_by_attrs(name="MyLora", base=BaseModelType.Sdxl, type=ModelType.LoRA)
// after
candidates = ctx._services.model_manager.store.search_by_attr(model_name="MyLora", base_model=BaseModelType.Sdxl, model_type=ModelType.LoRA)
model = ctx.models.load(key=candidates[0].key)  # unique key, no ambiguity
Defensive patterns

Strategy: try-catch

Validate before calling

configs = services.model_manager.store.search_by_attr(model_name=name, base_model=base, model_type=type)
if len(configs) > 1:
    keys = [c.key for c in configs]
    raise RuntimeError(f"ambiguous model {name!r}: {keys}; load by key instead")

Try / catch

try:
    model = ctx.models.load_by_attrs(name=name, base=base, type=type)
except ValueError as e:
    if "More than one model found" in str(e):
        logger.error("Duplicate model entries for %s; dedupe and rescan", name)
        model = None
    else:
        raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29). Data as JSON: /api/errors/0756cff919154178. Report an issue: GitHub.