invoke-ai/InvokeAI · error · ValueError

The {model_name} model must be a Diffusers-style FLUX.2 pipe

Error message

The {model_name} model must be a Diffusers-style FLUX.2 pipeline (with VAE / Qwen3 submodels). The selected model '{config.name}' is in {config.format.value} format.

What it means

_validate_diffusers_format raised ValueError because the selected model's config format is neither ModelFormat.Diffusers nor a self-contained SDNQ pipeline. This validator is used when a Diffusers-style pipeline with VAE/Qwen3 submodels is required (as the VAE source or encoder source), and single-file SDNQ checkpoints or partial pipelines missing submodels are rejected.

Source

Thrown at invokeai/app/invocations/flux2_klein_model_loader.py:212

    def _validate_diffusers_format(
        self, context: InvocationContext, model: ModelIdentifierField, model_name: str
    ) -> AnyModelConfig:
        """Validate that a model exposes the diffusers-style submodel layout 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], and the linear UI relies on that
        (``buildFLUXGraph`` falls back to *any* FLUX.2 diffusers pipeline when only the VAE is
        needed). Variant gating belongs to the encoder path only — see ``_validate_encoder_source``.

        Plain diffusers pipelines qualify, as do SDNQ-quantized pipeline folders that ship the VAE +
        Qwen3 submodels; single-file SDNQ FLUX.2 checkpoints and partial pipelines (missing VAE /
        Qwen3 submodels) are rejected.
        """
        config = context.models.get_config(model)
        if config.format == ModelFormat.Diffusers or is_self_contained_sdnq_pipeline(config):
            return config
        raise ValueError(
            f"The {model_name} model must be a Diffusers-style FLUX.2 pipeline (with VAE / Qwen3 "
            f"submodels). The selected model '{config.name}' is in {config.format.value} format."
        )

    def _validate_encoder_source(
        self,
        context: InvocationContext,
        model: ModelIdentifierField,
        model_name: str,
        main_config: AnyModelConfig,
    ) -> None:
        """Validate a Diffusers pipeline used as the *text encoder* source.

        The source's tokenizer + encoder are extracted and paired with *this* model's transformer,
        so they must come from the same Qwen3 family. Mismatched widths produce conditioning that
        only fails as an opaque matmul error deep in denoise, so reject it here where the user still
        gets a clear message. The linear UI (``buildFLUXGraph``) and the standalone-encoder path
        (``_validate_qwen3_encoder_variant``) already enforce the family match; the workflow editor

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Select a full Diffusers-format FLUX.2 Klein pipeline as the 'Qwen3 Source' model
  2. Convert the single-file checkpoint into a Diffusers pipeline directory containing VAE and Qwen3 submodels
  3. Verify the chosen model's format in the model manager is Diffusers (or a self-contained SDNQ pipeline)
  4. Catch ValueError and validate config.format before wiring the loader input

Example fix

// before
loader.qwen3_source_model = single_file_gguf_model   # format=GGUF
// after
cfg = context.models.get_config(diffusers_klein_pipeline)
assert cfg.format == ModelFormat.Diffusers
loader.qwen3_source_model = diffusers_klein_pipeline
Defensive patterns

Strategy: validation

Validate before calling

cfg = context.models.get_config(source_model)
from invokeai.backend.model_manager import is_self_contained_sdnq_pipeline
if cfg.format != ModelFormat.Diffusers and not is_self_contained_sdnq_pipeline(cfg):
    raise ValueError(f"{cfg.name} is not a Diffusers-style FLUX.2 pipeline")

Type guard

def is_diffusers_pipeline(config) -> bool:
    return config.format == ModelFormat.Diffusers or is_self_contained_sdnq_pipeline(config)

Try / catch

try:
    output = loader.invoke(context)
except ValueError as e:
    if 'must be a Diffusers-style FLUX.2 pipeline' in str(e):
        loader.qwen3_source_model = select_diffusers_klein_pipeline(context)
        output = loader.invoke(context)
    else:
        raise

Prevention

When it happens

Trigger: Calling invoke() (directly or via _validate_encoder_source) with self.qwen3_source_model (or another validated model) whose context.models.get_config(model).format is e.g. Checkpoint/Safetensors/GGUF and which is not is_self_contained_sdnq_pipeline(config).

Common situations: Pointing 'Qwen3 Source' at the same single-file checkpoint being loaded instead of a full Diffusers pipeline; selecting a GGUF checkpoint as the extraction source; a Diffusers folder missing VAE/Qwen3 submodels failing the self-contained SDNQ check.

Related errors


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