invoke-ai/InvokeAI · error · ValueError
Unknown lora: {lora_key}!
Error message
Unknown lora: {lora_key}! What it means
The Anima LoRA loader requires the referenced LoRA key to exist in the model manager. If context.models.exists(lora_key) is False, the loader raises this ValueError. It also raises a related error if the LoRA is already applied to the transformer or Qwen3 encoder.
Source
Thrown at invokeai/app/invocations/anima_lora_loader.py:63
weight: float = InputField(default=0.75, description=FieldDescriptions.lora_weight)
transformer: TransformerField | None = InputField(
default=None,
description=FieldDescriptions.transformer,
input=Input.Connection,
title="Anima Transformer",
)
qwen3_encoder: Qwen3EncoderField | None = InputField(
default=None,
title="Qwen3 Encoder",
description=FieldDescriptions.qwen3_encoder,
input=Input.Connection,
)
def invoke(self, context: InvocationContext) -> AnimaLoRALoaderOutput:
lora_key = self.lora.key
if not context.models.exists(lora_key):
raise ValueError(f"Unknown lora: {lora_key}!")
if self.transformer and any(lora.lora.key == lora_key for lora in self.transformer.loras):
raise ValueError(f'LoRA "{lora_key}" already applied to transformer.')
if self.qwen3_encoder and any(lora.lora.key == lora_key for lora in self.qwen3_encoder.loras):
raise ValueError(f'LoRA "{lora_key}" already applied to Qwen3 encoder.')
output = AnimaLoRALoaderOutput()
if self.transformer is not None:
output.transformer = self.transformer.model_copy(deep=True)
output.transformer.loras.append(
LoRAField(
lora=self.lora,
weight=self.weight,
)
)
if self.qwen3_encoder is not None:
output.qwen3_encoder = self.qwen3_encoder.model_copy(deep=True)View on GitHub (pinned to 0b6a024f2f)
Solutions
- Install the missing LoRA via the model manager so its key exists, or update the workflow to reference the installed LoRA's key.
- Check context.models.exists(key) / the Models tab for the exact key and fix the reference.
- Re-link the LoRA loader node's model field in the workflow UI after re-import.
Example fix
// before
lora_field = LoRAModelField(key="char_lora_old_key") // deleted/never installed
// after
if (context.models.exists("char_lora_new_key")) {
lora_field = LoRAModelField(key="char_lora_new_key")
} Defensive patterns
Strategy: validation
Validate before calling
if not context.models.exists(lora_key):
raise LookupError(f"LoRA {lora_key} not installed; install it or fix the workflow reference") Try / catch
try:
output = lora_loader.invoke(context)
except ValueError as e:
if str(e).startswith("Unknown lora:"):
missing = str(e).split(":", 1)[1].strip().rstrip("!")
install_or_relink_lora(missing) # import the model, then update the node key
else:
raise Prevention
- Verify LoRA keys exist in the model manager before submitting workflows
- Re-link LoRA nodes after re-importing models (keys can change)
- When sharing workflows, ship the model list or remap keys on import
When it happens
Trigger: Referencing a LoRA by key that was deleted, renamed, or never installed; running a saved workflow whose LoRA key no longer matches any model in the manager.
Common situations: Moving workflows between machines with different model libraries; deleting or re-importing a LoRA which changes its key; typos in keys when scripting workflows via the API.
Related errors
- Unknown lora: {lora_key}!
- Unknown lora: {lora.lora.key}!
- Unknown lora: {self.lora.key}!
- Unknown lora: {lora_key}!
- Unknown lora: {lora_key}!
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/36369ec30b49e3bf.
Report an issue: GitHub.