invoke-ai/InvokeAI · error · ValueError

LoRA '{lora_config.name}' is a {lora_variant.value} LoRA and

Error message

LoRA '{lora_config.name}' is a {lora_variant.value} LoRA and cannot be applied via the FLUX.2 [dev] loader. Use the FLUX.2 Klein LoRA loader for Klein LoRAs.

What it means

_assert_dev_lora is a backend backstop ensuring only FLUX.2 [dev] variant LoRAs reach the dev loader. If the LoRA model config's variant is set (e.g. Klein) and is not Flux2VariantType.Dev, the loader refuses to apply it because it would shape-error at denoise time.

Source

Thrown at invokeai/app/invocations/flux2_dev_lora_loader.py:40

)
from invokeai.app.services.shared.invocation_context import InvocationContext
from invokeai.backend.model_manager.taxonomy import BaseModelType, Flux2VariantType, ModelType


def _assert_dev_lora(context: InvocationContext, lora_config) -> None:
    """Reject a non-dev FLUX.2 LoRA applied via the FLUX.2 [dev] loaders.

    A Klein LoRA (hidden 3072/4096) applied to a dev transformer/encoder (hidden 5120/6144)
    is guaranteed to raise a shape-mismatch ``RuntimeError`` partway through denoise. Fail
    fast here with an actionable message instead. This is independent of *which* input the
    LoRA is wired to — the mismatch happens on whichever module it patches — so the check
    is not gated on the transformer being connected. The frontend also filters these out
    before they reach the graph (see ``addFlux2DevLoRAs``); this is the backend backstop for
    hand-built workflow graphs.
    """
    lora_variant = getattr(lora_config, "variant", None)
    if lora_variant is not None and lora_variant != Flux2VariantType.Dev:
        raise ValueError(
            f"LoRA '{lora_config.name}' is a {lora_variant.value} LoRA and cannot be applied via the "
            "FLUX.2 [dev] loader. Use the FLUX.2 Klein LoRA loader for Klein LoRAs."
        )


@invocation_output("flux2_dev_lora_loader_output")
class Flux2DevLoRALoaderOutput(BaseInvocationOutput):
    """FLUX.2 [dev] LoRA loader output."""

    transformer: Optional[TransformerField] = OutputField(
        default=None, description=FieldDescriptions.transformer, title="Transformer"
    )
    mistral_encoder: Optional[MistralEncoderField] = OutputField(
        default=None, description=FieldDescriptions.mistral_encoder, title="Mistral Encoder"
    )


@invocation(

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Use the FLUX.2 Klein LoRA loader invocation instead of the dev loader for this LoRA
  2. Or select a FLUX.2 [dev] variant LoRA in the dev loader's lora field
  3. Check the model's variant in Model Manager and fix mismatched loader nodes in the graph

Example fix

# before
loader = Flux2DevLoRALoaderInvocation(lora=klein_lora_key, transformer=x)
# after
loader = Flux2KleinLoRALoaderInvocation(lora=klein_lora_key, transformer=x)
Defensive patterns

Strategy: validation

Validate before calling

cfg = context.models.get_config(lora_key)
variant = getattr(cfg, 'variant', None)
if variant is not None and variant != Flux2VariantType.Dev:
    raise ValueError(f'{cfg.name} is {variant.value}, not Dev')

Type guard

def is_dev_lora(cfg) -> bool:
    v = getattr(cfg, 'variant', None)
    return v is None or v == Flux2VariantType.Dev

Try / catch

try:
    out = loader.invoke(context)
except ValueError as e:
    if 'Use the FLUX.2 Klein LoRA loader' in str(e):
        out = klein_loader.invoke(context)  # swap loader node
    else:
        raise

Prevention

When it happens

Trigger: invoking Flux2DevLoRALoaderInvocation whose self.lora resolves (via context.models.get_config) to a model config with variant != Dev, e.g. a FLUX.2 Klein LoRA wired into the dev loader.

Common situations: Hand-building workflow graphs (frontend normally filters via addFlux2DevLoRAs); switching the main model from dev to Klein but keeping dev loader nodes; downloading a Klein LoRA and wiring it into the dev LoRA loader node.

Related errors


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