{"record":{"id":"39731950e9c1e9c3","repo":"invoke-ai/InvokeAI","slug":"state-dict-does-not-look-like-a-flux-checkpoint","errorCode":null,"errorMessage":"state dict does not look like a FLUX checkpoint","messagePattern":"state dict does not look like a FLUX checkpoint","errorType":"exception","errorClass":"NotAMatchError","httpStatus":null,"severity":"info","filePath":"invokeai/backend/model_manager/configs/main.py","lineNumber":654,"sourceCode":"        cls._validate_does_not_look_like_bnb_quantized(mod)\n\n        cls._validate_does_not_look_like_gguf_quantized(mod)\n\n        variant = override_fields.pop(\"variant\", None) or cls._get_variant_or_raise(mod)\n\n        return cls(**override_fields, variant=variant)\n\n    @classmethod\n    def _validate_is_flux(cls, mod: ModelOnDisk) -> None:\n        state_dict = mod.load_state_dict()\n        if not state_dict_has_any_keys_exact(\n            state_dict,\n            {\n                \"double_blocks.0.img_attn.norm.key_norm.scale\",\n                \"model.diffusion_model.double_blocks.0.img_attn.norm.key_norm.scale\",\n            },\n        ):\n            raise NotAMatchError(\"state dict does not look like a FLUX checkpoint\")\n\n        # Exclude FLUX.2 models - they have their own config class\n        if _is_flux2_model(state_dict):\n            raise NotAMatchError(\"model is a FLUX.2 model, not FLUX.1\")\n\n    @classmethod\n    def _get_variant_or_raise(cls, mod: ModelOnDisk) -> FluxVariantType:\n        # FLUX Model variant types are distinguished by input channels and the presence of certain keys.\n        state_dict = mod.load_state_dict()\n        variant = _get_flux_variant(state_dict)\n\n        if variant is None:\n            # TODO(psyche): Should we have a graceful fallback here? Previously we fell back to the \"normal\" variant,\n            # but this variant is no longer used for FLUX models. If we get here, but the model is definitely a FLUX\n            # model, we should figure out a good fallback value.\n            raise NotAMatchError(\"unable to determine model variant from state dict\")\n\n        return variant","sourceCodeStart":636,"sourceCodeEnd":672,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/configs/main.py#L636-L672","documentation":"The FLUX.1 main-model config validates the state dict contains known FLUX signature keys (double_blocks img_attn norm scales, with or without the model.diffusion_model prefix). If neither is present, the checkpoint is not FLUX.1 and NotAMatchError is raised. This is probe-chain behavior directing the model to another config class.","triggerScenarios":"from_model_on_disk → _validate_is_flux on a state dict missing both 'double_blocks.0.img_attn.norm.key_norm.scale' and its model.diffusion_model-prefixed variant.","commonSituations":"Importing a non-FLUX checkpoint (SD/SDXL/SD3) while expecting FLUX handling; loading a FLUX.2 model (handled by the subsequent check); quantized/repacked FLUX files with transformed key layouts (e.g. GGUF/comfy rewraps).","solutions":["If the model is FLUX.2, this error is expected — it is routed to the FLUX.2 config; ensure your InvokeAI version supports FLUX.2.","If the model is FLUX.1 in a repacked/quantized format, convert it to standard FLUX.1 checkpoint layout or use a loader that understands the format.","Verify the file is actually a FLUX.1 checkpoint by grepping for 'double_blocks' keys in the state dict.","Re-download the checkpoint if keys look truncated."],"exampleFix":"// key check before import\nsd = load_file('flux.safetensors')\nassert any('double_blocks.0.img_attn.norm.key_norm.scale' in k for k in sd), 'not standard FLUX.1 layout'","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"def is_flux1_checkpoint(sd: dict) -> bool:\n    sigs = {'double_blocks.0.img_attn.norm.key_norm.scale',\n            'model.diffusion_model.double_blocks.0.img_attn.norm.key_norm.scale'}\n    return bool(sigs & set(sd.keys()))","tryCatchPattern":"try:\n    cfg = probe_model(path)\nexcept NotAMatchError:\n    pass  # expected during probe chain; next config class may match","preventionTips":["Let the probe chain try all config classes","Use standard FLUX.1 checkpoint layouts (avoid repacked/quantized key rewrites for import)","Keep InvokeAI updated for FLUX.1/FLUX.2 split handling"],"tags":["flux","checkpoint","model-probe"],"backgroundTag":"unrecognized-model-format","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}