{"record":{"id":"3d2ea94591a3b9d2","repo":"invoke-ai/InvokeAI","slug":"the-model-name-model-must-be-a-flux-2-dev-pipe","errorCode":null,"errorMessage":"The {model_name} model must be a FLUX.2 [dev] pipeline, but the selected model '{config.name}' is variant '{variant.value}'. Its text encoder is incompatible with the [dev] transformer. (Its VAE is compatible - this only blocks encoder extraction.)","messagePattern":"The (.+?) model must be a FLUX\\.2 \\[dev\\] pipeline, but the selected model '(.+?)' is variant '(.+?)'\\. Its text encoder is incompatible with the \\[dev\\] transformer\\. \\(Its VAE is compatible - this only blocks encoder extraction\\.\\)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/flux2_dev_model_loader.py","lineNumber":208,"sourceCode":"        if config.format != ModelFormat.Diffusers:\n            raise ValueError(\n                f\"The {model_name} model must be a Diffusers format model. \"\n                f\"The selected model '{config.name}' is in {config.format.value} format.\"\n            )\n        return config\n\n    def _validate_encoder_source(\n        self, context: InvocationContext, model: ModelIdentifierField, model_name: str\n    ) -> None:\n        \"\"\"Validate a Diffusers pipeline used as the *text encoder* source.\"\"\"\n        config = self._validate_diffusers_format(context, model, model_name)\n        # The source's tokenizer/encoder are extracted and paired with the [dev] transformer.\n        # A Klein pipeline's Qwen3 tokenizer + encoder silently pass the layer-count guard and\n        # produce a wrong-width conditioning that only surfaces as an opaque matmul error deep in\n        # denoise, so reject non-[dev] sources here where the user still gets a clear message.\n        variant = getattr(config, \"variant\", None)\n        if variant is not None and variant != Flux2VariantType.Dev:\n            raise ValueError(\n                f\"The {model_name} model must be a FLUX.2 [dev] pipeline, \"\n                f\"but the selected model '{config.name}' is variant '{variant.value}'. \"\n                \"Its text encoder is incompatible with the [dev] transformer. \"\n                \"(Its VAE is compatible - this only blocks encoder extraction.)\"\n            )\n","sourceCodeStart":190,"sourceCodeEnd":214,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/flux2_dev_model_loader.py#L190-L214","documentation":"_validate_encoder_source throws this when the Diffusers model used to extract a text encoder is a FLUX.2 Klein pipeline rather than FLUX.2 [dev]. Klein's Qwen3 tokenizer/encoder can silently pass layer-count checks and produce wrong-width conditioning that only fails as an opaque matmul error deep in denoising, so the loader rejects non-[dev] variants early with a clear message. The VAE from Klein is still acceptable; only encoder extraction is blocked.","triggerScenarios":"_validate_encoder_source is called (via invoke() when 'Mistral Source' supplies the encoder) and getattr(config, 'variant') is a Flux2VariantType other than Flux2VariantType.Dev.","commonSituations":"A user selects a FLUX.2 Klein (4B/9B) Diffusers pipeline as the 'Mistral Source', assuming any FLUX.2 diffusers model works, when they actually want dev conditioning for the [dev] transformer.","solutions":["Point the 'Mistral Source' input at a FLUX.2 [dev] Diffusers pipeline (variant 'dev').","If only the VAE was needed from this source, keep the Klein pipeline for the VAE but supply the encoder via a standalone 'Mistral Encoder' input instead."],"exampleFix":"// before\nmistral_source = flux2_klein_4b_pipeline  // variant: klein\n// after\nmistral_source = flux2_dev_pipeline  // variant: dev","handlingStrategy":"validation","validationCode":"config = context.models.get_config(model)\nvariant = getattr(config, \"variant\", None)\nif variant is not None and variant != Flux2VariantType.Dev:\n    raise ValueError(f\"Encoder source '{config.name}' is variant '{variant.value}', not dev\")","typeGuard":"def is_flux2_dev(config) -> bool:\n    return getattr(config, \"variant\", None) == Flux2VariantType.Dev","tryCatchPattern":"try:\n    output = loader.invoke(context)\nexcept ValueError as e:\n    if \"must be a FLUX.2 [dev] pipeline\" in str(e):\n        loader.mistral_source_model = select_dev_variant_model(context)\n        output = loader.invoke(context)\n    else:\n        raise","preventionTips":["Verify the model's variant is 'dev' in the Model Manager before using it as an encoder source.","Klein pipelines are fine for VAE extraction but never for encoder extraction.","Keep dev and Klein models clearly named/segregated to avoid mix-ups."],"tags":["invokeai","model-variant","validation","flux2","text-encoder"],"backgroundTag":"incompatible-model-variant","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}