invoke-ai/InvokeAI · error · ValueError

Unknown lora: {lora.lora.key}!

Error message

Unknown lora: {lora.lora.key}!

What it means

While iterating over LoRAs to apply, the loader verifies each LoRA model still exists in the model manager via context.models.exists(key). If the key is not found, it raises. This means the graph references a LoRA model that has been deleted, renamed, or belongs to another installation.

Source

Thrown at invokeai/app/invocations/anima_lora_loader.py:150

            return output

        loras = self.loras if isinstance(self.loras, list) else [self.loras]
        added_loras: list[str] = []

        if self.transformer is not None:
            output.transformer = self.transformer.model_copy(deep=True)

        if self.qwen3_encoder is not None:
            output.qwen3_encoder = self.qwen3_encoder.model_copy(deep=True)

        for lora in loras:
            if lora is None:
                continue
            if lora.lora.key in added_loras:
                continue

            if not context.models.exists(lora.lora.key):
                raise ValueError(f"Unknown lora: {lora.lora.key}!")

            if lora.lora.base is not BaseModelType.Anima:
                raise ValueError(
                    f"LoRA '{lora.lora.key}' is for {lora.lora.base.value if lora.lora.base else 'unknown'} models, "
                    "not Anima models. Ensure you are using an Anima compatible LoRA."
                )

            added_loras.append(lora.lora.key)

            if self.transformer is not None and output.transformer is not None:
                output.transformer.loras.append(lora)

            if self.qwen3_encoder is not None and output.qwen3_encoder is not None:
                output.qwen3_encoder.loras.append(lora)

        return output

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Install the missing LoRA model into InvokeAI so its key resolves, or re-scan the models directory.
  2. Remove the dangling LoRA node from the workflow, or re-select the LoRA in the UI to bind a valid model.
  3. If the key came from an old workflow, update it to the re-imported model's new key.

Example fix

// before
for lora in loras: apply(lora)  # may hit missing model
// after
for lora in loras:
    if context.models.exists(lora.lora.key):
        apply(lora)
    else:
        logger.warning(f"Skipping missing LoRA {lora.lora.key}")
Defensive patterns

Strategy: validation

Validate before calling

for lora in loras:
    if not context.models.exists(lora.lora.key):
        print(f"LoRA missing from model manager: {lora.lora.key}")

Try / catch

try:
    output = lora_loader.invoke(context)
except ValueError as e:
    if str(e).startswith("Unknown lora"):
        reinstall_or_remove_lora(e)
    else:
        raise

Prevention

When it happens

Trigger: Invoking AnimaLoRALoader (or a loader iterating self.transformer.loras) when context.models.exists(lora.lora.key) returns False — the model record is missing from the database or files are gone.

Common situations: Sharing workflows between machines where the LoRA was never installed; deleting a model in the UI while a workflow still references it; a stale model key after re-scanning or re-configuring the models directory.

Related errors


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