{"record":{"id":"3f0462b7cbf4410c","repo":"invoke-ai/InvokeAI","slug":"unknown-lora-lora-lora-key-3f0462","errorCode":null,"errorMessage":"Unknown lora: {lora.lora.key}!","messagePattern":"Unknown lora: (.+?)!","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/z_image_lora_loader.py","lineNumber":153,"sourceCode":"    def invoke(self, context: InvocationContext) -> ZImageLoRALoaderOutput:\n        output = ZImageLoRALoaderOutput()\n        loras = self.loras if isinstance(self.loras, list) else [self.loras]\n        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.qwen3_encoder is not None:\n            output.qwen3_encoder = self.qwen3_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.ZImage:\n                raise ValueError(\n                    f\"LoRA '{lora.lora.key}' is for {lora.lora.base.value if lora.lora.base else 'unknown'} models, \"\n                    \"not Z-Image models. Ensure you are using a Z-Image compatible LoRA.\"\n                )\n\n            # Warn on variant mismatch between LoRA and transformer.\n            lora_config = context.models.get_config(lora.lora.key)\n            lora_variant = getattr(lora_config, \"variant\", None)\n            if lora_variant and self.transformer is not None:\n                transformer_config = context.models.get_config(self.transformer.transformer.key)\n                transformer_variant = getattr(transformer_config, \"variant\", None)\n                if transformer_variant and lora_variant != transformer_variant:\n                    context.logger.warning(\n                        f\"LoRA variant mismatch: LoRA '{lora_config.name}' is for {lora_variant.value} \"\n                        f\"but transformer is {transformer_variant.value}. This may cause unexpected results.\"\n                    )","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/z_image_lora_loader.py#L135-L171","documentation":"When collecting LoRAs attached to the loader's inputs, the invocation re-validates each LoRA key against the model manager and raises a plain Exception if the key no longer exists. Unlike error 563 (the primary LoRA field), this fires for LoRAs already attached to the transformer or Qwen3 encoder fields whose records have vanished.","triggerScenarios":"During ZImageLoRALoaderOutput construction, iterating self.transformer.loras / self.qwen3_encoder.loras and encountering an entry whose lora.lora.key fails context.models.exists().","commonSituations":"A LoRA referenced by a saved graph was deleted or its model record was purged; reinstalling InvokeAI with a different models.db; shared workflow imports with foreign keys.","solutions":["Re-install the missing LoRA so its key exists again.","Open the loader node and re-select/replace the dead LoRA entry on the transformer or encoder input.","Re-scan the models directory so orphaned references are reported and fixable in the UI."],"exampleFix":"// before\ntransformer.loras = [LoRAField(lora=ModelIdentifierField(key='gone-key'))]\n// after\ntransformer.loras = [LoRAField(lora=ModelIdentifierField(key='installed-key'))]","handlingStrategy":"validation","validationCode":"for l in list(loader.transformer.loras if loader.transformer else []) + list(loader.qwen3_encoder.loras if loader.qwen3_encoder else []):\n    if not context.models.exists(l.lora.key):\n        raise ValueError(f\"Attached LoRA {l.lora.key} is missing; re-select it before invoking\")","typeGuard":null,"tryCatchPattern":"try:\n    out = z_image_lora_loader.invoke(context)\nexcept Exception as e:\n    if str(e).startswith(\"Unknown lora:\"):\n        context.logger.error(f\"{e} - reinstall the LoRA or remove the stale entry from the transformer/encoder input.\")\n    else:\n        raise","preventionTips":["Check attached LoRA references after deleting any model from the manager.","Re-scan models after upgrades or database restores.","Avoid importing workflows that reference another installation's keys without re-selecting them."],"tags":["lora","model-not-found","z-image","stale-reference"],"backgroundTag":"model-not-found","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}