{"record":{"id":"82782d966afdcf80","repo":"invoke-ai/InvokeAI","slug":"the-model-name-model-must-be-a-diffusers-style-f","errorCode":null,"errorMessage":"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.","messagePattern":"The (.+?) model must be a Diffusers-style FLUX\\.2 pipeline \\(with VAE / Qwen3 submodels\\)\\. The selected model '(.+?)' is in (.+?) format\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/flux2_klein_model_loader.py","lineNumber":212,"sourceCode":"\n    def _validate_diffusers_format(\n        self, context: InvocationContext, model: ModelIdentifierField, model_name: str\n    ) -> AnyModelConfig:\n        \"\"\"Validate that a model exposes the diffusers-style submodel layout and return its config.\n\n        Deliberately format-only, because this also gates the VAE-extraction path: the 32-channel\n        ``AutoencoderKLFlux2`` is shared between Klein and [dev], and the linear UI relies on that\n        (``buildFLUXGraph`` falls back to *any* FLUX.2 diffusers pipeline when only the VAE is\n        needed). Variant gating belongs to the encoder path only — see ``_validate_encoder_source``.\n\n        Plain diffusers pipelines qualify, as do SDNQ-quantized pipeline folders that ship the VAE +\n        Qwen3 submodels; single-file SDNQ FLUX.2 checkpoints and partial pipelines (missing VAE /\n        Qwen3 submodels) are rejected.\n        \"\"\"\n        config = context.models.get_config(model)\n        if config.format == ModelFormat.Diffusers or is_self_contained_sdnq_pipeline(config):\n            return config\n        raise ValueError(\n            f\"The {model_name} model must be a Diffusers-style FLUX.2 pipeline (with VAE / Qwen3 \"\n            f\"submodels). The selected model '{config.name}' is in {config.format.value} format.\"\n        )\n\n    def _validate_encoder_source(\n        self,\n        context: InvocationContext,\n        model: ModelIdentifierField,\n        model_name: str,\n        main_config: AnyModelConfig,\n    ) -> None:\n        \"\"\"Validate a Diffusers pipeline used as the *text encoder* source.\n\n        The source's tokenizer + encoder are extracted and paired with *this* model's transformer,\n        so they must come from the same Qwen3 family. Mismatched widths produce conditioning that\n        only fails as an opaque matmul error deep in denoise, so reject it here where the user still\n        gets a clear message. The linear UI (``buildFLUXGraph``) and the standalone-encoder path\n        (``_validate_qwen3_encoder_variant``) already enforce the family match; the workflow editor","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/flux2_klein_model_loader.py#L194-L230","documentation":"_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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Select a full Diffusers-format FLUX.2 Klein pipeline as the 'Qwen3 Source' model","Convert the single-file checkpoint into a Diffusers pipeline directory containing VAE and Qwen3 submodels","Verify the chosen model's format in the model manager is Diffusers (or a self-contained SDNQ pipeline)","Catch ValueError and validate config.format before wiring the loader input"],"exampleFix":"// before\nloader.qwen3_source_model = single_file_gguf_model   # format=GGUF\n// after\ncfg = context.models.get_config(diffusers_klein_pipeline)\nassert cfg.format == ModelFormat.Diffusers\nloader.qwen3_source_model = diffusers_klein_pipeline","handlingStrategy":"validation","validationCode":"cfg = context.models.get_config(source_model)\nfrom invokeai.backend.model_manager import is_self_contained_sdnq_pipeline\nif cfg.format != ModelFormat.Diffusers and not is_self_contained_sdnq_pipeline(cfg):\n    raise ValueError(f\"{cfg.name} is not a Diffusers-style FLUX.2 pipeline\")","typeGuard":"def is_diffusers_pipeline(config) -> bool:\n    return config.format == ModelFormat.Diffusers or is_self_contained_sdnq_pipeline(config)","tryCatchPattern":"try:\n    output = loader.invoke(context)\nexcept ValueError as e:\n    if 'must be a Diffusers-style FLUX.2 pipeline' in str(e):\n        loader.qwen3_source_model = select_diffusers_klein_pipeline(context)\n        output = loader.invoke(context)\n    else:\n        raise","preventionTips":["Verify model format in the model manager before using it as a submodel source","Convert single-file checkpoints to Diffusers layout if you need them as pipeline sources","Confirm the Diffusers folder contains VAE and Qwen3 submodels"],"tags":["model-format","diffusers","validation","invokeai"],"backgroundTag":"model-format-mismatch","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}