{"record":{"id":"e673bc8832ca317a","repo":"invoke-ai/InvokeAI","slug":"unknown-lora-lora-key-e673bc","errorCode":null,"errorMessage":"Unknown lora: {lora_key}!","messagePattern":"Unknown lora: (.+?)!","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/flux2_klein_lora_loader.py","lineNumber":85,"sourceCode":"    weight: float = InputField(default=0.75, description=FieldDescriptions.lora_weight)\n    transformer: TransformerField | None = InputField(\n        default=None,\n        description=FieldDescriptions.transformer,\n        input=Input.Connection,\n        title=\"Transformer\",\n    )\n    qwen3_encoder: Qwen3EncoderField | None = InputField(\n        default=None,\n        title=\"Qwen3 Encoder\",\n        description=FieldDescriptions.qwen3_encoder,\n        input=Input.Connection,\n    )\n\n    def invoke(self, context: InvocationContext) -> Flux2KleinLoRALoaderOutput:\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(lora_key)\n        # Reject cross-family (dev) LoRAs regardless of which input they're wired to.\n        _assert_not_dev_lora(context, lora_config)\n\n        # Warn if LoRA variant doesn't match transformer variant (intra-Klein 4B/9B).\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 shape errors.\"\n                )\n\n        # Check for existing LoRAs with the same key.\n        if self.transformer and any(lora.lora.key == lora_key for lora in self.transformer.loras):","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/flux2_klein_lora_loader.py#L67-L103","documentation":"The FLUX.2 Klein LoRA loader raises this ValueError when the key of the LoRA model reference in the lora input does not exist in the model manager. context.models.exists(lora_key) returns False, meaning the model record is missing - typically deleted, never imported, or a stale reference from a moved/renamed model.","triggerScenarios":"invoke() reads lora_key = self.lora.key and context.models.exists(lora_key) is False before any config lookup.","commonSituations":"A workflow saved on another machine references a LoRA not installed locally; the LoRA was deleted or re-imported under a new key; or the model database was reset while the workflow kept the old reference.","solutions":["Install/import the referenced LoRA into InvokeAI's model manager so its key exists.","Re-select the LoRA in the Klein LoRA loader node to refresh the stale model reference.","Re-open and re-save the workflow after re-selecting, so the embedded key matches the local model database."],"exampleFix":"// before\nloader = Flux2KleinLoRALoader(lora=stale_lora_ref)  // key not in model manager\n// after\nloader = Flux2KleinLoRALoader(lora=context.models.get_config_by_name('my_klein_lora').key)","handlingStrategy":"validation","validationCode":"lora_key = lora_ref.key\nif not context.models.exists(lora_key):\n    raise ValueError(f\"LoRA {lora_key} is not installed; re-select it in the Model Manager\")","typeGuard":"def lora_is_installed(context, lora_ref) -> bool:\n    return context.models.exists(lora_ref.key)","tryCatchPattern":"try:\n    output = klein_lora_loader.invoke(context)\nexcept ValueError as e:\n    if str(e).startswith(\"Unknown lora:\"):\n        lora_ref = reselect_lora_by_name(context, lora_ref.name)\n        klein_lora_loader.lora = lora_ref\n        output = klein_lora_loader.invoke(context)\n    else:\n        raise","preventionTips":["Ensure all LoRAs referenced by a workflow are installed on the target machine.","Re-select LoRAs in loader nodes after re-importing or moving models (keys change).","Avoid hand-editing workflow JSON model keys; pick models via the UI."],"tags":["invokeai","lora","model-not-found","stale-reference","flux2"],"backgroundTag":"model-not-found","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}