{"record":{"id":"721a5265636422ef","repo":"invoke-ai/InvokeAI","slug":"lora-lora-key-already-applied-to-primary-trans","errorCode":null,"errorMessage":"LoRA \"{lora_key}\" already applied to primary transformer list.","messagePattern":"LoRA \"(.+?)\" already applied to primary transformer list\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/wan_lora_loader.py","lineNumber":197,"sourceCode":"            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.')\n        if to_low_noise and any(item.lora.key == lora_key for item in self.transformer.loras_low_noise):\n            raise ValueError(f'LoRA \"{lora_key}\" already applied to low-noise transformer list.')\n\n        output.transformer = self.transformer.model_copy(deep=True)\n        new_lora = LoRAField(lora=self.lora, weight=self.weight)\n        if to_primary:\n            output.transformer.loras.append(new_lora)\n        if to_low_noise:\n            output.transformer.loras_low_noise.append(new_lora)\n\n        return output\n\n\n@invocation(\n    \"wan_lora_collection_loader\",\n    title=\"Apply LoRA Collection - Wan 2.2\",\n    tags=[\"lora\", \"model\", \"wan\"],\n    category=\"model\",","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/wan_lora_loader.py#L179-L215","documentation":"The single Wan LoRA loader raises this when target routing sends the LoRA to the primary (high-noise) list but that list already contains a LoRA with the same key. Re-appending would double the effective LoRA weight, so the loader rejects it instead of silently stacking. Duplicate detection is by lora.key, not by weight or node instance.","triggerScenarios":"Chaining two WanLoRALoaderInvocation nodes (or re-entering the same transformer field) that both apply the same LoRA to the primary list; a workflow where the same LoRA node's output is wired into the transformer twice; target set to 'high'/'both' for a LoRA already present in transformer.loras.","commonSituations":"Users stacking LoRA loader nodes and accidentally adding the same LoRA twice; duplicating a loader node in the workflow editor; combining a collection loader with a single loader that both include the same LoRA.","solutions":["Remove the duplicate LoRA loader node, or unselect the LoRA in one of the two nodes.","If you intended a stronger effect, raise the weight on the single entry instead of adding it twice.","Check the upstream transformer field: only one loader should append a given lora key to loras."],"exampleFix":"// before: same lora applied twice -> ValueError\ntransformer.loras.append(LoRAField(lora=lora, weight=0.75))\ntransformer.loras.append(LoRAField(lora=lora, weight=1.0))\n// after: single entry with combined intent\ntransformer.loras.append(LoRAField(lora=lora, weight=1.0))","handlingStrategy":"validation","validationCode":"if any(item.lora.key == lora.key for item in transformer.loras):\n    skip_or_merge_weights()  # don't wire a second loader for the same lora","typeGuard":"def is_duplicate(transformer, lora_key: str) -> bool:\n    return any(item.lora.key == lora_key for item in transformer.loras)","tryCatchPattern":"try:\n    out = loader.invoke(context)\nexcept ValueError as e:\n    if \"already applied to primary transformer list\" in str(e):\n        remove_duplicate_loader_node()  # or raise weight on the existing entry\n    else:\n        raise","preventionTips":["Apply each LoRA in exactly one node per workflow.","To strengthen an effect, increase the weight instead of adding a duplicate entry.","Audit chains where multiple LoRA loaders feed one transformer field."],"tags":["invokeai","lora","duplicate","workflow"],"backgroundTag":"duplicate-lora-application","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}