{"record":{"id":"5b8b3f34f12824c3","repo":"invoke-ai/InvokeAI","slug":"unknown-lora-lora-key-5b8b3f","errorCode":null,"errorMessage":"Unknown lora: {lora_key}!","messagePattern":"Unknown lora: (.+?)!","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/wan_lora_loader.py","lineNumber":179,"sourceCode":"    target: WanLoRATarget = InputField(\n        default=\"auto\",\n        description=\"Which expert(s) to apply this LoRA to. 'auto' uses the LoRA's \"\n        \"recorded expert tag (or both if untagged); 'both'/'high'/'low' override it. \"\n        \"On the single-transformer TI2V-5B, which has no low-noise expert, 'low' is \"\n        \"applied to the transformer instead of being discarded.\",\n    )\n    transformer: WanTransformerField | None = InputField(\n        default=None,\n        description=FieldDescriptions.transformer,\n        input=Input.Connection,\n        title=\"Wan Transformer\",\n    )\n\n    def invoke(self, context: InvocationContext) -> WanLoRALoaderOutput:\n        lora_key = self.lora.key\n\n        if not context.models.exists(lora_key):\n            raise ValueError(f\"Unknown lora: {lora_key}!\")\n\n        lora_config = context.models.get_config(self.lora)\n        _assert_is_wan_lora(lora_config, lora_key)\n\n        output = WanLoRALoaderOutput()\n        if self.transformer is None:\n            return output\n\n        main_config = context.models.get_config(self.transformer.transformer)\n        _assert_lora_variant_matches_main(lora_config, main_config, lora_key)\n\n        lora_expert = getattr(lora_config, \"expert\", None)\n        to_primary, to_low_noise = _resolve_target(self.target, lora_expert)\n        to_primary, to_low_noise = _correct_inert_low_routing(context, main_config, lora_key, to_primary, to_low_noise)\n\n        # Reject duplicates on whichever list(s) we're about to append to.\n        if to_primary and any(item.lora.key == lora_key for item in self.transformer.loras):\n            raise ValueError(f'LoRA \"{lora_key}\" already applied to primary transformer list.')","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/wan_lora_loader.py#L161-L197","documentation":"WanLoRALoaderInvocation.invoke raises this ValueError when the LoRA model identified by self.lora.key does not exist in the model manager (context.models.exists returns False). It is a guard ensuring the referenced LoRA record is present before any config lookup or loading. The graph node cannot proceed without a valid, installed LoRA model.","triggerScenarios":"Calling the 'wan_lora_loader' invocation with a lora ModelIdentifierField whose key is not in the model manager: the model was uninstalled/deleted after the workflow was saved, the workflow was imported with keys from another InvokeAI instance, or a stale/edited key was injected.","commonSituations":"Restoring a workflow JSON on a fresh install without the LoRA; deleting the LoRA from the model manager while a saved workflow still references it; hand-editing or migrating graph state with stale model keys; syncing workflows across machines with different model installs.","solutions":["Install/import the referenced LoRA model in InvokeAI's model manager (Wan base, LoRA type) so the key resolves.","Open the workflow and re-select the LoRA in the 'Apply LoRA - Wan 2.2' node to refresh the ModelIdentifierField key.","If migrating workflows, rebind model fields to models present on the target instance."],"exampleFix":"// before: workflow references a deleted lora key\nself.lora.key  # \"88f3...\" no longer exists -> ValueError: Unknown lora!\n// after: re-select the LoRA in the node UI, or verify first\nif not context.models.exists(lora_key):\n    # install the LoRA or pick a different one in the node\n    ...","handlingStrategy":"validation","validationCode":"# before wiring/running the loader\nif not context.models.exists(lora_key):\n    raise LookupError(f\"LoRA {lora_key} not installed; install it or re-select in the node\")","typeGuard":"def lora_is_installed(context, lora: ModelIdentifierField) -> bool:\n    return context.models.exists(lora.key)","tryCatchPattern":"try:\n    out = wan_lora_loader.invoke(context)\nexcept ValueError as e:\n    if \"Unknown lora\" in str(e):\n        install_model(lora_key) or rebind_lora_field(node)\n    else:\n        raise","preventionTips":["After uninstalling models, re-validate all saved workflows that reference them.","Re-select model fields when importing workflows from another instance.","Never hand-edit model keys in workflow JSON; use the node UI."],"tags":["invokeai","lora","model-manager","missing-model"],"backgroundTag":"model-key-not-found","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}