{"record":{"id":"fbce5872609266f7","repo":"invoke-ai/InvokeAI","slug":"model-is-not-a-flux-2-diffusers-lora","errorCode":null,"errorMessage":"model is not a FLUX.2 Diffusers LoRA","messagePattern":"model is not a FLUX\\.2 Diffusers LoRA","errorType":"exception","errorClass":"NotAMatchError","httpStatus":null,"severity":"info","filePath":"invokeai/backend/model_manager/configs/lora.py","lineNumber":1323,"sourceCode":"    variant: Flux2VariantType | None = Field(default=None)\n\n    @classmethod\n    def from_model_on_disk(cls, mod: ModelOnDisk, override_fields: dict[str, Any]) -> Self:\n        raise_if_not_dir(mod)\n        raise_for_override_fields(cls, override_fields)\n        cls._validate_base(mod)\n        path_to_weight_file = cls._get_weight_file_or_raise(mod)\n        state_dict = mod.load_state_dict(path_to_weight_file)\n        override_fields.setdefault(\"variant\", _get_flux2_lora_variant(state_dict))\n        return cls(**override_fields)\n\n    @classmethod\n    def _get_base_or_raise(cls, mod: ModelOnDisk) -> BaseModelType:\n        path_to_weight_file = cls._get_weight_file_or_raise(mod)\n        state_dict = mod.load_state_dict(path_to_weight_file)\n        if _is_flux2_lora_state_dict(state_dict):\n            return BaseModelType.Flux2\n        raise NotAMatchError(\"model is not a FLUX.2 Diffusers LoRA\")\n\n\nclass LoRA_Diffusers_ZImage_Config(LoRA_Diffusers_Config_Base, Config_Base):\n    \"\"\"Model config for Z-Image LoRA models in Diffusers format.\"\"\"\n\n    base: Literal[BaseModelType.ZImage] = Field(default=BaseModelType.ZImage)\n    variant: ZImageVariantType | None = Field(default=None)\n","sourceCodeStart":1305,"sourceCodeEnd":1331,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/configs/lora.py#L1305-L1331","documentation":"The FLUX.2 Diffusers LoRA config class probes the state dict with _is_flux2_lora_state_dict(); if the keys do not match a FLUX.2 LoRA, it raises NotAMatchError. This class only accepts FLUX.2 (Klein) LoRAs, so the error simply means the directory holds some other model type and the next config class in the probe chain should be tried.","triggerScenarios":"from_model_on_disk / _validate_base on a directory that has pytorch_lora_weights.{bin,safetensors} but whose state dict fails _is_flux2_lora_state_dict — i.e. not a FLUX.2 LoRA.","commonSituations":"Scanning a FLUX.1 LoRA, SDXL LoRA, or a full FLUX.2 checkpoint (not a LoRA) against the FLUX.2 LoRA config during model import; mismatched format after a InvokeAI/FLUX.2 version change.","solutions":["Confirm the model really is a FLUX.2 LoRA (Diffusers format); if it is FLUX.1, it belongs to a different config class and the error is expected probe noise.","If it is a full FLUX.2 checkpoint rather than a LoRA, import it as a main model, not a LoRA.","Inspect the state dict keys for FLUX.2 LoRA signatures before importing.","Update InvokeAI so the probe chain includes the correct config class for your model format."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"def looks_like_flux2_lora(sd: dict) -> bool:\n    from invokeai.backend.model_manager.configs.lora import _is_flux2_lora_state_dict\n    return _is_flux2_lora_state_dict(sd)","tryCatchPattern":"try:\n    cfg = probe_model(mod)\nexcept NotAMatchError:\n    cfg = None  # probe chain will try the next config class; treat as non-FLUX.2","preventionTips":["Know your model's base before import","Let the full probe chain run rather than calling a single config class","Keep InvokeAI current for FLUX.2 support"],"tags":["lora","flux2","model-probe"],"backgroundTag":"unrecognized-model-format","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}