invoke-ai/InvokeAI · error · ValueError

LoRA '{lora.lora.key}' is for {lora.lora.base.value if lora.

Error message

LoRA '{lora.lora.key}' is for {lora.lora.base.value if lora.lora.base else 'unknown'} models, not FLUX.2 Klein models. Ensure you are using a FLUX.2 compatible LoRA.

What it means

invoke() raised ValueError because the LoRA's base model type is not BaseModelType.Flux2. The loader only accepts FLUX.2-family LoRAs and rejects anything trained for another architecture (SD1/SDXL/FLUX.1 dev etc.), matching the single-LoRA loader's guard. This prevents shape/dtype errors from applying incompatible weights.

Source

Thrown at invokeai/app/invocations/flux2_klein_lora_loader.py:184

        added_loras: list[str] = []

        if self.transformer is not None:
            output.transformer = self.transformer.model_copy(deep=True)

        if self.qwen3_encoder is not None:
            output.qwen3_encoder = self.qwen3_encoder.model_copy(deep=True)

        for lora in loras:
            if lora is None:
                continue
            if lora.lora.key in added_loras:
                continue

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

            if lora.lora.base is not BaseModelType.Flux2:
                raise ValueError(
                    f"LoRA '{lora.lora.key}' is for {lora.lora.base.value if lora.lora.base else 'unknown'} models, "
                    "not FLUX.2 Klein models. Ensure you are using a FLUX.2 compatible LoRA."
                )

            lora_config = context.models.get_config(lora.lora.key)
            # Reject cross-family (dev) LoRAs, matching the single-LoRA loader above.
            _assert_not_dev_lora(context, lora_config)

            # Warn if LoRA variant doesn't match transformer variant (intra-Klein 4B/9B).
            lora_variant = getattr(lora_config, "variant", None)
            if lora_variant and self.transformer is not None:
                transformer_config = context.models.get_config(self.transformer.transformer.key)
                transformer_variant = getattr(transformer_config, "variant", None)
                if transformer_variant and lora_variant != transformer_variant:
                    context.logger.warning(
                        f"LoRA variant mismatch: LoRA '{lora_config.name}' is for {lora_variant.value} "
                        f"but transformer is {transformer_variant.value}. This may cause shape errors."
                    )

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Replace the LoRA with one trained for FLUX.2 Klein (base model Flux2)
  2. Check the LoRA's base model in the model manager and remove incompatible entries from the workflow
  3. Re-download the LoRA from a source that offers a FLUX.2 build
  4. Catch ValueError and skip/filter LoRAs whose base != Flux2 before invoking

Example fix

// before
loader.loras = [sdxl_lora, flux2_lora]
// after
loader.loras = [l for l in loader.loras if l.lora.base == BaseModelType.Flux2]
output = loader.invoke(context)
Defensive patterns

Strategy: validation

Validate before calling

bad = [l for l in loader.loras
       if getattr(l.lora, 'base', None) != BaseModelType.Flux2]
if bad:
    raise ValueError(f"Non-FLUX.2 LoRAs: {[l.lora.key for l in bad]}")

Type guard

def is_flux2_lora(lora) -> bool:
    return lora.lora.base is BaseModelType.Flux2

Try / catch

try:
    output = loader.invoke(context)
except ValueError as e:
    if 'not FLUX.2 Klein models' in str(e):
        loader.loras = [l for l in loader.loras if l.lora.base is BaseModelType.Flux2]
        output = loader.invoke(context)
    else:
        raise

Prevention

When it happens

Trigger: A LoRA whose lora.lora.base is any BaseModelType other than Flux2 is included in the loader input during invoke(); if base is None it reports 'unknown'.

Common situations: User downloaded an SDXL or FLUX.1-dev LoRA and attached it to a FLUX.2 Klein workflow; old workflow referencing a LoRA re-imported under a different base type; cross-family (dev) LoRA mistaken for a Klein-compatible one.

Related errors


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