invoke-ai/InvokeAI · error · ValueError

LoRA "{lora_key}" already applied to primary transformer lis

Error message

LoRA "{lora_key}" already applied to primary transformer list.

What it means

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.

Source

Thrown at invokeai/app/invocations/wan_lora_loader.py:197

            raise ValueError(f"Unknown lora: {lora_key}!")

        lora_config = context.models.get_config(self.lora)
        _assert_is_wan_lora(lora_config, lora_key)

        output = WanLoRALoaderOutput()
        if self.transformer is None:
            return output

        main_config = context.models.get_config(self.transformer.transformer)
        _assert_lora_variant_matches_main(lora_config, main_config, lora_key)

        lora_expert = getattr(lora_config, "expert", None)
        to_primary, to_low_noise = _resolve_target(self.target, lora_expert)
        to_primary, to_low_noise = _correct_inert_low_routing(context, main_config, lora_key, to_primary, to_low_noise)

        # Reject duplicates on whichever list(s) we're about to append to.
        if to_primary and any(item.lora.key == lora_key for item in self.transformer.loras):
            raise ValueError(f'LoRA "{lora_key}" already applied to primary transformer list.')
        if to_low_noise and any(item.lora.key == lora_key for item in self.transformer.loras_low_noise):
            raise ValueError(f'LoRA "{lora_key}" already applied to low-noise transformer list.')

        output.transformer = self.transformer.model_copy(deep=True)
        new_lora = LoRAField(lora=self.lora, weight=self.weight)
        if to_primary:
            output.transformer.loras.append(new_lora)
        if to_low_noise:
            output.transformer.loras_low_noise.append(new_lora)

        return output


@invocation(
    "wan_lora_collection_loader",
    title="Apply LoRA Collection - Wan 2.2",
    tags=["lora", "model", "wan"],
    category="model",

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Remove the duplicate LoRA loader node, or unselect the LoRA in one of the two nodes.
  2. If you intended a stronger effect, raise the weight on the single entry instead of adding it twice.
  3. Check the upstream transformer field: only one loader should append a given lora key to loras.

Example fix

// before: same lora applied twice -> ValueError
transformer.loras.append(LoRAField(lora=lora, weight=0.75))
transformer.loras.append(LoRAField(lora=lora, weight=1.0))
// after: single entry with combined intent
transformer.loras.append(LoRAField(lora=lora, weight=1.0))
Defensive patterns

Strategy: validation

Validate before calling

if any(item.lora.key == lora.key for item in transformer.loras):
    skip_or_merge_weights()  # don't wire a second loader for the same lora

Type guard

def is_duplicate(transformer, lora_key: str) -> bool:
    return any(item.lora.key == lora_key for item in transformer.loras)

Try / catch

try:
    out = loader.invoke(context)
except ValueError as e:
    if "already applied to primary transformer list" in str(e):
        remove_duplicate_loader_node()  # or raise weight on the existing entry
    else:
        raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29). Data as JSON: /api/errors/721a5265636422ef. Report an issue: GitHub.