invoke-ai/InvokeAI · error · Exception
Unknown lora: {lora.lora.key}!
Error message
Unknown lora: {lora.lora.key}! What it means
During FLUX LoRA collection, the invocation verifies each LoRA key exists in the model manager via context.models.exists(). If the key is absent it raises Exception('Unknown lora: ...'). This means the graph references a LoRA model record that no longer exists in the InvokeAI model registry.
Source
Thrown at invokeai/app/invocations/flux_lora_loader.py:167
added_loras: list[str] = []
if self.transformer is not None:
output.transformer = self.transformer.model_copy(deep=True)
if self.clip is not None:
output.clip = self.clip.model_copy(deep=True)
if self.t5_encoder is not None:
output.t5_encoder = self.t5_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 Exception(f"Unknown lora: {lora.lora.key}!")
if lora.lora.base is not BaseModelType.Flux:
raise ValueError(
f"LoRA '{lora.lora.key}' is for {lora.lora.base.value if lora.lora.base else 'unknown'} models, "
"not FLUX models. Ensure you are using a FLUX 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.clip is not None and output.clip is not None:
output.clip.loras.append(lora)
if self.t5_encoder is not None and output.t5_encoder is not None:
output.t5_encoder.loras.append(lora)
View on GitHub (pinned to 0b6a024f2f)
Solutions
- Open the workflow in InvokeAI and re-select the LoRA from the model dropdown to refresh its key
- Re-install/scan the LoRA in the Model Manager so its key exists again
- Remove the stale LoRA node/field from the graph
- Check context.models.exists(key) in custom code before invoking
Example fix
// before: hardcoded stale key lora=ModelIdentifierField(key='old_deleted_lora') // after: re-pick the model in the UI so the current key is written lora=ModelIdentifierField(key='<current-key-from-model-manager>')
Defensive patterns
Strategy: validation
Validate before calling
if not context.models.exists(lora_key):
raise ValueError(f"LoRA {lora_key} missing from registry; re-select it in the workflow") Type guard
def lora_exists(context, lora_key: str) -> bool:
return context.models.exists(lora_key) Try / catch
try:
output = collector.invoke(context)
except Exception as e:
if str(e).startswith('Unknown lora:'):
missing_key = str(e).split(':', 1)[1].strip(' !')
# re-select or remove the LoRA node referencing missing_key
else:
raise Prevention
- Re-select LoRAs in workflows after reinstalling or migrating models
- Never hardcode LoRA keys in generated graphs
- Periodically validate workflow model references against the registry
When it happens
Trigger: A FLUX LoRA reference field points at a model key that was deleted, purged, or never installed; a stale workflow saved against a since-removed model; a hand-edited graph with an invalid key.
Common situations: Deleting a LoRA in the Model Manager while old workflows still reference it; syncing models across machines; installing InvokeAI fresh and importing old graphs.
Related errors
- Unknown lora: {lora.lora.key}!
- LoRA "{lora_key}" already applied to transformer.
- LoRA "{lora_key}" already applied to CLIP encoder.
- LoRA "{lora_key}" already applied to T5 encoder.
- LoRA '{lora.lora.key}' is for {lora.lora.base.value if lora.
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/5e5d2103f1b07a93.
Report an issue: GitHub.