invoke-ai/InvokeAI · error · ValueError

LoRA '{lora_config.name}' is a FLUX.2 [dev] LoRA and cannot

Error message

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

What it means

_assert_not_dev_lora in the FLUX.2 Klein LoRA loader raises this ValueError when the selected LoRA is tagged as a FLUX.2 [dev] LoRA. Dev LoRAs target the [dev] transformer architecture; applying them via the Klein loader would guarantee a shape-mismatch RuntimeError during denoise. This fail-fast backstop exists for hand-built workflow graphs, since the frontend normally filters such combinations.

Source

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

    invocation_output,
)
from invokeai.app.invocations.fields import FieldDescriptions, Input, InputField, OutputField
from invokeai.app.invocations.model import LoRAField, ModelIdentifierField, Qwen3EncoderField, TransformerField
from invokeai.app.services.shared.invocation_context import InvocationContext
from invokeai.backend.model_manager.taxonomy import BaseModelType, Flux2VariantType, ModelType


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

    A dev LoRA (hidden 5120/6144) on a Klein transformer/encoder (hidden 3072/4096) is
    guaranteed to raise a shape-mismatch ``RuntimeError`` during denoise. Fail fast here,
    independent of which input the LoRA is wired to. (The frontend filters these out before
    they reach the graph; this is the backstop for hand-built workflow graphs.) Intra-Klein
    4B-vs-9B mismatches remain a soft warning below.
    """
    if getattr(lora_config, "variant", None) == Flux2VariantType.Dev:
        raise ValueError(
            f"LoRA '{lora_config.name}' is a FLUX.2 [dev] LoRA and cannot be applied via the "
            "FLUX.2 Klein LoRA loader. Use the FLUX.2 [dev] LoRA loader for dev LoRAs."
        )


@invocation_output("flux2_klein_lora_loader_output")
class Flux2KleinLoRALoaderOutput(BaseInvocationOutput):
    """FLUX.2 Klein LoRA Loader Output"""

    transformer: Optional[TransformerField] = OutputField(
        default=None, description=FieldDescriptions.transformer, title="Transformer"
    )
    qwen3_encoder: Optional[Qwen3EncoderField] = OutputField(
        default=None, description=FieldDescriptions.qwen3_encoder, title="Qwen3 Encoder"
    )


@invocation(

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Replace the LoRA with a FLUX.2 Klein-compatible LoRA in the Klein LoRA loader.
  2. If the intent is to use a dev LoRA, switch the workflow to the FLUX.2 [dev] pipeline and the FLUX.2 [dev] LoRA loader.
  3. If the LoRA is actually a Klein LoRA, fix its model manager metadata so its variant is not tagged 'dev'.

Example fix

// before
klein_loader = Flux2KleinLoRALoader(lora=flux2_dev_lora)
// after
klein_loader = Flux2KleinLoRALoader(lora=flux2_klein_4b_lora)
Defensive patterns

Strategy: validation

Validate before calling

lora_config = context.models.get_config(lora_key)
if getattr(lora_config, "variant", None) == Flux2VariantType.Dev:
    raise ValueError("This is a FLUX.2 [dev] LoRA; use the [dev] LoRA loader")

Type guard

def is_dev_lora(config) -> bool:
    return getattr(config, "variant", None) == Flux2VariantType.Dev

Try / catch

try:
    output = klein_lora_loader.invoke(context)
except ValueError as e:
    if "is a FLUX.2 [dev] LoRA" in str(e):
        dev_loader = Flux2DevLoRALoader(lora=lora_ref)
        output = dev_loader.invoke(context)
    else:
        raise

Prevention

When it happens

Trigger: invoke() of flux2_klein_lora_loader calls _assert_not_dev_lora(context, lora_config) and getattr(lora_config, 'variant') == Flux2VariantType.Dev, regardless of which loader input the LoRA is wired to.

Common situations: A user hand-wires a FLUX.2 [dev] LoRA into a Klein workflow graph (bypassing frontend filtering), or picks a dev LoRA from the model list while assembling a Klein pipeline.

Related errors


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