invoke-ai/InvokeAI · error · ValueError

LoRA "{lora_key}" already applied to Qwen3 encoder.

Error message

LoRA "{lora_key}" already applied to Qwen3 encoder.

What it means

The Anima LoRA loader also guards the Qwen3 text encoder against double application. It scans self.qwen3_encoder.loras and raises if a LoRA with the same key is already present. Duplicate patches on the encoder would double the LoRA's influence on text embeddings.

Source

Thrown at invokeai/app/invocations/anima_lora_loader.py:68

        title="Anima Transformer",
    )
    qwen3_encoder: Qwen3EncoderField | None = InputField(
        default=None,
        title="Qwen3 Encoder",
        description=FieldDescriptions.qwen3_encoder,
        input=Input.Connection,
    )

    def invoke(self, context: InvocationContext) -> AnimaLoRALoaderOutput:
        lora_key = self.lora.key

        if not context.models.exists(lora_key):
            raise ValueError(f"Unknown lora: {lora_key}!")

        if self.transformer and any(lora.lora.key == lora_key for lora in self.transformer.loras):
            raise ValueError(f'LoRA "{lora_key}" already applied to transformer.')
        if self.qwen3_encoder and any(lora.lora.key == lora_key for lora in self.qwen3_encoder.loras):
            raise ValueError(f'LoRA "{lora_key}" already applied to Qwen3 encoder.')

        output = AnimaLoRALoaderOutput()

        if self.transformer is not None:
            output.transformer = self.transformer.model_copy(deep=True)
            output.transformer.loras.append(
                LoRAField(
                    lora=self.lora,
                    weight=self.weight,
                )
            )
        if self.qwen3_encoder is not None:
            output.qwen3_encoder = self.qwen3_encoder.model_copy(deep=True)
            output.qwen3_encoder.loras.append(
                LoRAField(
                    lora=self.lora,
                    weight=self.weight,
                )

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Remove the duplicate LoRA entry/connection targeting the Qwen3 encoder.
  2. Ensure each unique LoRA key appears in only one loader invocation per graph run.
  3. If accumulation is intended, skip loading when the key is already present instead of invoking the loader again.

Example fix

// before
enc_loader = AnimaLoRALoader(qwen3_encoder=prev_enc, lora=my_lora)  # key already in prev_enc.loras
// after
if my_lora.key not in [l.lora.key for l in prev_enc.loras]:
    enc_loader = AnimaLoRALoader(qwen3_encoder=prev_enc, lora=my_lora)
else:
    qwen3_encoder = prev_enc  # already applied
Defensive patterns

Strategy: validation

Validate before calling

existing = {l.lora.key for l in qwen3_encoder.loras}
if lora.key in existing:
    raise ValueError(f'LoRA "{lora.key}" already applied to Qwen3 encoder.')

Prevention

When it happens

Trigger: Invoking AnimaLoRALoader when the qwen3_encoder sub-model's loras list already contains an entry with lora.key equal to self.lora.key — typically from invoking the loader twice on the same encoder state.

Common situations: Chaining two LoRA loader invocations that both include the same LoRA; workflows where the encoder output is looped back through the loader; duplicated nodes in an imported workflow.

Related errors


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