{"record":{"id":"9b2724bd73aaf404","repo":"invoke-ai/InvokeAI","slug":"unknown-lora-lora-lora-key-9b2724","errorCode":null,"errorMessage":"Unknown lora: {lora.lora.key}!","messagePattern":"Unknown lora: (.+?)!","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/flux2_dev_lora_loader.py","lineNumber":161,"sourceCode":"    )\n\n    def invoke(self, context: InvocationContext) -> Flux2DevLoRALoaderOutput:\n        output = Flux2DevLoRALoaderOutput()\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        if self.mistral_encoder is not None:\n            output.mistral_encoder = self.mistral_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            if not context.models.exists(lora.lora.key):\n                raise Exception(f\"Unknown lora: {lora.lora.key}!\")\n\n            # A FLUX.1 LoRA (base `flux`) has no variant field, so `_assert_dev_lora` below\n            # would pass it through to model patching where it fails late. Fail fast here with\n            # a clear error instead, matching the Klein collection loader. (A bare `assert`\n            # would also be stripped under `python -O`.)\n            if lora.lora.base is not BaseModelType.Flux2:\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.2 [dev] models. Ensure you are using a FLUX.2 [dev] compatible LoRA.\"\n                )\n\n            lora_config = context.models.get_config(lora.lora.key)\n            # Reject variant-mismatched LoRAs, matching the single-LoRA loader above.\n            _assert_dev_lora(context, lora_config)\n\n            added_loras.append(lora.lora.key)\n\n            if self.transformer is not None and output.transformer is not None:","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/flux2_dev_lora_loader.py#L143-L179","documentation":"The FLUX.2 dev LoRA collection loader iterates LoRAs accumulated on the transformer and encoder and verifies each still exists in the model store before patching. If a key is missing it raises Exception (not ValueError) with the unknown key.","triggerScenarios":"invoking Flux2DevLoRAModelPagerInvocation (collection loader) where any LoRAField in the transformer/encoder loras lists resolves to a key absent from context.models — model uninstalled between building the chain and running it.","commonSituations":"Stale saved workflows referencing deleted models; shared graphs from machines with different model sets; interrupted model imports.","solutions":["Reinstall the missing LoRA via Model Manager so the key resolves","Rebuild the LoRA loader chain selecting only currently installed LoRAs","Pre-check every lora key with context.models.exists before invoking the pager and prune missing entries"],"exampleFix":"# before\nloras = existing_chain_loras  # contains an uninstalled key\n# after\nloras = [l for l in existing_chain_loras if context.models.exists(l.lora.key)]","handlingStrategy":"validation","validationCode":"missing = [l.lora.key for l in loras if l is not None and not context.models.exists(l.lora.key)]\nif missing:\n    raise ValueError(f'missing loras: {missing}')","typeGuard":null,"tryCatchPattern":"try:\n    out = pager.invoke(context)\nexcept Exception as e:\n    if str(e).startswith('Unknown lora:'):\n        loras = [l for l in loras if context.models.exists(l.lora.key)]\n        out = pager.invoke(context)\n    else:\n        raise","preventionTips":["Validate all chain LoRA keys exist before invoking the collection loader","Prune missing models from saved workflows on import","Rebuild loader chains after uninstalling any model"],"tags":["model-manager","lora","missing-model"],"backgroundTag":"model-not-found","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}