{"record":{"id":"5e5d2103f1b07a93","repo":"invoke-ai/InvokeAI","slug":"unknown-lora-lora-lora-key-5e5d21","errorCode":null,"errorMessage":"Unknown lora: {lora.lora.key}!","messagePattern":"Unknown lora: (.+?)!","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/flux_lora_loader.py","lineNumber":167,"sourceCode":"        added_loras: list[str] = []\n\n        if self.transformer is not None:\n            output.transformer = self.transformer.model_copy(deep=True)\n\n        if self.clip is not None:\n            output.clip = self.clip.model_copy(deep=True)\n\n        if self.t5_encoder is not None:\n            output.t5_encoder = self.t5_encoder.model_copy(deep=True)\n\n        for lora in loras:\n            if lora is None:\n                continue\n            if lora.lora.key in added_loras:\n                continue\n\n            if not context.models.exists(lora.lora.key):\n                raise Exception(f\"Unknown lora: {lora.lora.key}!\")\n\n            if lora.lora.base is not BaseModelType.Flux:\n                raise ValueError(\n                    f\"LoRA '{lora.lora.key}' is for {lora.lora.base.value if lora.lora.base else 'unknown'} models, \"\n                    \"not FLUX models. Ensure you are using a FLUX compatible LoRA.\"\n                )\n\n            added_loras.append(lora.lora.key)\n\n            if self.transformer is not None and output.transformer is not None:\n                output.transformer.loras.append(lora)\n\n            if self.clip is not None and output.clip is not None:\n                output.clip.loras.append(lora)\n\n            if self.t5_encoder is not None and output.t5_encoder is not None:\n                output.t5_encoder.loras.append(lora)\n","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/flux_lora_loader.py#L149-L185","documentation":"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.","triggerScenarios":"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.","commonSituations":"Deleting a LoRA in the Model Manager while old workflows still reference it; syncing models across machines; installing InvokeAI fresh and importing old graphs.","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"],"exampleFix":"// before: hardcoded stale key\nlora=ModelIdentifierField(key='old_deleted_lora')\n// after: re-pick the model in the UI so the current key is written\nlora=ModelIdentifierField(key='<current-key-from-model-manager>')","handlingStrategy":"validation","validationCode":"if not context.models.exists(lora_key):\n    raise ValueError(f\"LoRA {lora_key} missing from registry; re-select it in the workflow\")","typeGuard":"def lora_exists(context, lora_key: str) -> bool:\n    return context.models.exists(lora_key)","tryCatchPattern":"try:\n    output = collector.invoke(context)\nexcept Exception as e:\n    if str(e).startswith('Unknown lora:'):\n        missing_key = str(e).split(':', 1)[1].strip(' !')\n        # re-select or remove the LoRA node referencing missing_key\n    else:\n        raise","preventionTips":["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"],"tags":["lora","missing-model","model-registry","flux","invokeai"],"backgroundTag":"unknown-model-key","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}