invoke-ai/InvokeAI · error · ValueError

The {model_name} model must be a Diffusers format model. The

Error message

The {model_name} model must be a Diffusers format model. The selected model '{config.name}' is in {config.format.value} format.

What it means

_validate_diffusers_format throws this when a model supplied as a VAE or encoder source is not in Diffusers format. Only Diffusers-format pipelines can have submodels (VAE, tokenizer, text encoder) extracted via model_copy; single-file or GGUF checkpoints cannot. The f-string interpolates the expected role, the actual model name, and its actual format.

Source

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

        self, context: InvocationContext, model: ModelIdentifierField, model_name: str
    ) -> AnyModelConfig:
        """Validate that a model is a Diffusers-format pipeline and return its config.

        Deliberately format-only, because this also gates the VAE-extraction path: the 32-channel
        ``AutoencoderKLFlux2`` is shared between Klein and [dev] — the repo ships the Klein-sourced
        ``flux2_vae`` as a dependency of every [dev] GGUF starter model — so a Klein pipeline is a
        legitimate VAE source for a [dev] transformer. ``mistral_source_model`` is not
        variant-filtered in the workflow editor, so the *encoder* path is where variant gating
        belongs — see ``_validate_encoder_source``.

        Note the [dev] linear UI is stricter than this: ``buildFLUXGraph`` sources from dev-only
        pipelines and readiness gates on one, so the Klein-pipeline-as-VAE-source case is reachable
        through the workflow editor only. (The Klein loader's linear UI *does* fall back to any
        FLUX.2 diffusers pipeline for the VAE.)
        """
        config = context.models.get_config(model)
        if config.format != ModelFormat.Diffusers:
            raise ValueError(
                f"The {model_name} model must be a Diffusers format model. "
                f"The selected model '{config.name}' is in {config.format.value} format."
            )
        return config

    def _validate_encoder_source(
        self, context: InvocationContext, model: ModelIdentifierField, model_name: str
    ) -> None:
        """Validate a Diffusers pipeline used as the *text encoder* source."""
        config = self._validate_diffusers_format(context, model, model_name)
        # The source's tokenizer/encoder are extracted and paired with the [dev] transformer.
        # A Klein pipeline's Qwen3 tokenizer + encoder silently pass the layer-count guard and
        # produce a wrong-width conditioning that only surfaces as an opaque matmul error deep in
        # denoise, so reject non-[dev] sources here where the user still gets a clear message.
        variant = getattr(config, "variant", None)
        if variant is not None and variant != Flux2VariantType.Dev:
            raise ValueError(
                f"The {model_name} model must be a FLUX.2 [dev] pipeline, "

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Select a Diffusers-format FLUX.2 [dev] model (the message names the format of the wrongly selected model) as the source.
  2. Download the Diffusers version of the FLUX.2 [dev] pipeline and register it in InvokeAI's model manager, then use that as the source.

Example fix

// before
mistral_source = single_file_flux2_checkpoint  // format: checkpoint
// after
mistral_source = diffusers_flux2_dev_pipeline  // format: diffusers
Defensive patterns

Strategy: validation

Validate before calling

config = context.models.get_config(model)
if config.format != ModelFormat.Diffusers:
    raise ValueError(f"{model_name} must be Diffusers format; '{config.name}' is {config.format.value}")

Type guard

def is_diffusers(config) -> bool:
    return getattr(config, "format", None) == ModelFormat.Diffusers

Try / catch

try:
    output = loader.invoke(context)
except ValueError as e:
    if "must be a Diffusers format model" in str(e):
        loader.mistral_source_model = select_diffusers_flux2_model(context)
        output = loader.invoke(context)
    else:
        raise

Prevention

When it happens

Trigger: _validate_diffusers_format(context, model, model_name) is called from invoke() (for 'Mistral Source') or _validate_encoder_source(), and context.models.get_config(model).format is not ModelFormat.Diffusers.

Common situations: A user points the 'Mistral Source' or 'VAE' input at a single-file checkpoint or GGUF model instead of a Diffusers FLUX.2 [dev] pipeline, often after downloading a ComfyUI-style single-file model.

Related errors


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