invoke-ai/InvokeAI · error · ValueError

FLUX.2 [dev] loader requires a FLUX.2 [dev] transformer, but

Error message

FLUX.2 [dev] loader requires a FLUX.2 [dev] transformer, but the selected model is variant '{variant.value}'. Use the FLUX.2 Klein loader for Klein variants.

What it means

Flux2DevModelLoaderInvocation requires the selected main model to be the FLUX.2 [dev] variant. invoke() reads the model config, and if it has a variant attribute that is not Flux2VariantType.Dev (i.e. a Klein variant), it raises ValueError directing the user to the FLUX.2 Klein loader, since dev and Klein loaders/weights are incompatible.

Source

Thrown at invokeai/app/invocations/flux2_dev_model_loader.py:121

        input=Input.Direct,
        ui_model_base=BaseModelType.Flux2,
        ui_model_type=ModelType.Main,
        ui_model_format=ModelFormat.Diffusers,
        title="Mistral Source (Diffusers)",
    )

    max_seq_len: Literal[256, 512] = InputField(
        default=512,
        description="Max sequence length for the Mistral encoder. FLUX.2 [dev] uses 512 by default.",
        title="Max Seq Length",
    )

    def invoke(self, context: InvocationContext) -> Flux2DevModelLoaderOutput:
        # Validate the selected main model is FLUX.2 [dev], not Klein.
        main_config = context.models.get_config(self.model)
        variant = getattr(main_config, "variant", None)
        if variant is not None and variant != Flux2VariantType.Dev:
            raise ValueError(
                f"FLUX.2 [dev] loader requires a FLUX.2 [dev] transformer, "
                f"but the selected model is variant '{variant.value}'. "
                "Use the FLUX.2 Klein loader for Klein variants."
            )

        transformer = self.model.model_copy(update={"submodel_type": SubModelType.Transformer})
        main_is_diffusers = main_config.format == ModelFormat.Diffusers

        # Resolve VAE.
        if self.vae_model is not None:
            vae = self.vae_model.model_copy(update={"submodel_type": SubModelType.VAE})
        elif main_is_diffusers:
            vae = self.model.model_copy(update={"submodel_type": SubModelType.VAE})
        elif self.mistral_source_model is not None:
            self._validate_diffusers_format(context, self.mistral_source_model, "Mistral Source")
            vae = self.mistral_source_model.model_copy(update={"submodel_type": SubModelType.VAE})
        else:
            raise ValueError(

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Select a FLUX.2 [dev] variant model in the loader's model field
  2. Use Flux2KleinModelLoaderInvocation instead if you intend to run a Klein model
  3. Check the model's variant attribute in Model Manager to confirm which loader it belongs to

Example fix

# before
loader = Flux2DevModelLoaderInvocation(model=klein_model_key)
# after
loader = Flux2KleinModelLoaderInvocation(model=klein_model_key)
# or: Flux2DevModelLoaderInvocation(model=dev_model_key)
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

def is_dev_transformer_model(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 loader' in str(e):
        out = klein_loader.invoke(context)
    else:
        raise

Prevention

When it happens

Trigger: Selecting a FLUX.2 Klein checkpoint in the dev model loader node and invoking; loading a stale graph where the model field points at a Klein model.

Common situations: Installing both dev and Klein models and picking the wrong one in the loader dropdown; switching model families mid-workflow without swapping loader nodes.

Related errors


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