{"record":{"id":"fa9837f9e1354ad0","repo":"invoke-ai/InvokeAI","slug":"flux-2-dev-loader-requires-a-flux-2-dev-transf","errorCode":null,"errorMessage":"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.","messagePattern":"FLUX\\.2 \\[dev\\] loader requires a FLUX\\.2 \\[dev\\] transformer, but the selected model is variant '(.+?)'\\. Use the FLUX\\.2 Klein loader for Klein variants\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/flux2_dev_model_loader.py","lineNumber":121,"sourceCode":"        input=Input.Direct,\n        ui_model_base=BaseModelType.Flux2,\n        ui_model_type=ModelType.Main,\n        ui_model_format=ModelFormat.Diffusers,\n        title=\"Mistral Source (Diffusers)\",\n    )\n\n    max_seq_len: Literal[256, 512] = InputField(\n        default=512,\n        description=\"Max sequence length for the Mistral encoder. FLUX.2 [dev] uses 512 by default.\",\n        title=\"Max Seq Length\",\n    )\n\n    def invoke(self, context: InvocationContext) -> Flux2DevModelLoaderOutput:\n        # Validate the selected main model is FLUX.2 [dev], not Klein.\n        main_config = context.models.get_config(self.model)\n        variant = getattr(main_config, \"variant\", None)\n        if variant is not None and variant != Flux2VariantType.Dev:\n            raise ValueError(\n                f\"FLUX.2 [dev] loader requires a FLUX.2 [dev] transformer, \"\n                f\"but the selected model is variant '{variant.value}'. \"\n                \"Use the FLUX.2 Klein loader for Klein variants.\"\n            )\n\n        transformer = self.model.model_copy(update={\"submodel_type\": SubModelType.Transformer})\n        main_is_diffusers = main_config.format == ModelFormat.Diffusers\n\n        # Resolve VAE.\n        if self.vae_model is not None:\n            vae = self.vae_model.model_copy(update={\"submodel_type\": SubModelType.VAE})\n        elif main_is_diffusers:\n            vae = self.model.model_copy(update={\"submodel_type\": SubModelType.VAE})\n        elif self.mistral_source_model is not None:\n            self._validate_diffusers_format(context, self.mistral_source_model, \"Mistral Source\")\n            vae = self.mistral_source_model.model_copy(update={\"submodel_type\": SubModelType.VAE})\n        else:\n            raise ValueError(","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/flux2_dev_model_loader.py#L103-L139","documentation":"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.","triggerScenarios":"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.","commonSituations":"Installing both dev and Klein models and picking the wrong one in the loader dropdown; switching model families mid-workflow without swapping loader nodes.","solutions":["Select a FLUX.2 [dev] variant model in the loader's model field","Use Flux2KleinModelLoaderInvocation instead if you intend to run a Klein model","Check the model's variant attribute in Model Manager to confirm which loader it belongs to"],"exampleFix":"# before\nloader = Flux2DevModelLoaderInvocation(model=klein_model_key)\n# after\nloader = Flux2KleinModelLoaderInvocation(model=klein_model_key)\n# or: Flux2DevModelLoaderInvocation(model=dev_model_key)","handlingStrategy":"validation","validationCode":"cfg = context.models.get_config(loader.model)\nvariant = getattr(cfg, 'variant', None)\nif variant is not None and variant != Flux2VariantType.Dev:\n    raise ValueError(f'{cfg.name} is {variant.value}; use Klein loader')","typeGuard":"def is_dev_transformer_model(cfg) -> bool:\n    v = getattr(cfg, 'variant', None)\n    return v is None or v == Flux2VariantType.Dev","tryCatchPattern":"try:\n    out = loader.invoke(context)\nexcept ValueError as e:\n    if 'Use the FLUX.2 Klein loader' in str(e):\n        out = klein_loader.invoke(context)\n    else:\n        raise","preventionTips":["Verify model variant matches the loader node family before running workflows","Keep dev and Klein models in clearly separated folders/names","Update loader nodes whenever switching between dev and Klein checkpoints"],"tags":["model-variant","flux2","validation","model-loader"],"backgroundTag":"model-variant-mismatch","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}