{"record":{"id":"700532df8254f7f0","repo":"invoke-ai/InvokeAI","slug":"unknown-lora-lora-key-700532","errorCode":null,"errorMessage":"Unknown lora: {lora_key}!","messagePattern":"Unknown lora: (.+?)!","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/krea2_lora_loader.py","lineNumber":61,"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=\"Krea-2 Transformer\",\n    )\n    qwen3_vl_encoder: Qwen3VLEncoderField | None = InputField(\n        default=None,\n        title=\"Qwen3-VL Encoder\",\n        description=FieldDescriptions.qwen3_vl_encoder,\n        input=Input.Connection,\n    )\n\n    def invoke(self, context: InvocationContext) -> Krea2LoRALoaderOutput:\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        stored_config = context.models.get_config(lora_key)\n        if (\n            self.lora.base is not BaseModelType.Krea2\n            or stored_config.base is not BaseModelType.Krea2\n            or stored_config.type is not ModelType.LoRA\n        ):\n            raise ValueError(\n                f\"LoRA '{lora_key}' is for {stored_config.base.value if stored_config.base else 'unknown'} models, \"\n                \"not Krea-2 models. Ensure you are using a Krea-2 compatible LoRA.\"\n            )\n\n        output = Krea2LoRALoaderOutput()\n\n        if self.transformer is not None:\n            output.transformer = self.transformer.model_copy(deep=True)\n        if self.qwen3_vl_encoder is not None:\n            output.qwen3_vl_encoder = self.qwen3_vl_encoder.model_copy(deep=True)","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/krea2_lora_loader.py#L43-L79","documentation":"Krea2LoRALoaderInvocation.invoke() resolves the LoRA model by its key via context.models.exists(). If no model record exists in the model manager for that key, it raises ValueError('Unknown lora: ...'). This guards against loading a LoRA whose model record has been deleted or never registered before attempting to fetch its config.","triggerScenarios":"Calling invoke() of Krea2LoRALoaderInvocation where self.lora.key does not exist in the model manager store, i.e. context.models.exists(lora_key) returns False.","commonSituations":"Referencing a LoRA from a saved workflow after the model was deleted or re-imported (changing its hash/key); copy-pasting workflow JSON between installs; stale model manager DB after upgrading InvokeAI; a LoRA installed after the graph was built.","solutions":["Re-select the LoRA in the LoRA loader node so the workflow stores the current valid model key.","Verify the model exists in the Model Manager (or via GET /api/v1/models) and re-import the LoRA file if missing.","Rebuild/convert the model manager database (invokeai-db) if keys changed after an upgrade.","Wrap model loading in a catch for ValueError and fall back to a default Krea2-compatible LoRA."],"exampleFix":"// before (stale key from old workflow)\n{ \"type\": \"krea2_lora_loader\", \"lora\": { \"key\": \"8f3c...old\" } }\n// after (key refreshed from model manager)\n{ \"type\": \"krea2_lora_loader\", \"lora\": { \"key\": \"a91d...current\" } }","handlingStrategy":"validation","validationCode":"lora_key = loader.lora.key\nif not context.models.exists(lora_key):\n    raise LookupError(f\"LoRA {lora_key} not in model manager - re-select or re-import it before invoking\")","typeGuard":null,"tryCatchPattern":"try:\n    output = loader.invoke(context)\nexcept ValueError as e:\n    if str(e).startswith(\"Unknown lora:\"):\n        output = fallback_loader_with_default_lora().invoke(context)\n    else:\n        raise","preventionTips":["Re-select LoRAs in the node editor after re-importing or deleting models","Don't share workflow JSON without verifying referenced model keys exist on the target install","Query the models API at graph build time to bind fresh keys","Avoid hardcoding model keys in scripts; resolve them by name/hash each run"],"tags":["model-manager","lora","valueerror","missing-model"],"backgroundTag":"unknown-model-key","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}