invoke-ai/InvokeAI · error · ValueError
LoRA model is in unsupported FLUX format
Error message
LoRA model is in unsupported FLUX format
What it means
This ValueError is thrown when loading a FLUX-base LoRA whose state_dict does not match any supported FLUX key naming scheme (e.g. diffusers-style or BFL/PEFT keys), or when the model's recorded format field is not a supported FLUX LoRA format. The loader inspects key patterns to decide between diffusers and BFL conversion helpers (flux1 vs flux2); unrecognized keys/format fall through to this error.
Source
Thrown at invokeai/backend/model_manager/load/model_loaders/lora.py:167
model = lora_model_from_flux_onetrainer_bfl_state_dict(state_dict=state_dict)
elif is_state_dict_likely_in_flux_onetrainer_format(state_dict=state_dict):
model = lora_model_from_flux_onetrainer_state_dict(state_dict=state_dict)
elif is_state_dict_likely_flux_control(state_dict=state_dict):
model = lora_model_from_flux_control_state_dict(state_dict=state_dict)
elif is_state_dict_likely_in_flux_aitoolkit_format(state_dict=state_dict):
model = lora_model_from_flux_aitoolkit_state_dict(state_dict=state_dict)
elif is_state_dict_likely_in_flux_xlabs_format(state_dict=state_dict):
model = lora_model_from_flux_xlabs_state_dict(state_dict=state_dict)
elif is_state_dict_likely_in_flux_bfl_peft_format(state_dict=state_dict):
if self._model_base == BaseModelType.Flux2:
# FLUX.2 Klein uses Flux2Transformer2DModel (diffusers naming),
# so we need to convert BFL keys to diffusers naming.
model = lora_model_from_flux2_bfl_peft_state_dict(state_dict=state_dict, alpha=None)
else:
# FLUX.1 uses BFL Flux class, so BFL keys work directly.
model = lora_model_from_flux_bfl_peft_state_dict(state_dict=state_dict, alpha=None)
else:
raise ValueError("LoRA model is in unsupported FLUX format")
else:
raise ValueError(f"LoRA model is in unsupported FLUX format: {config.format}")
elif self._model_base in [BaseModelType.StableDiffusion1, BaseModelType.StableDiffusion2]:
# Currently, we don't apply any conversions for SD1 and SD2 LoRA models.
model = lora_model_from_sd_state_dict(state_dict=state_dict)
elif self._model_base == BaseModelType.ZImage:
# Z-Image LoRAs use diffusers PEFT format with transformer and/or Qwen3 encoder layers.
# We set alpha=None to use rank as alpha (common default).
model = lora_model_from_z_image_state_dict(state_dict=state_dict, alpha=None)
elif self._model_base == BaseModelType.QwenImage:
model = lora_model_from_qwen_image_state_dict(state_dict=state_dict, alpha=None)
elif self._model_base == BaseModelType.Krea2:
# Krea-2 LoRAs use diffusers PEFT format targeting the Krea2 transformer (and optionally
# the Qwen3-VL text encoder). alpha=None → alpha=rank (common diffusers default).
model = lora_model_from_krea2_state_dict(state_dict=state_dict, alpha=None)
elif self._model_base == BaseModelType.Anima:
# Anima LoRAs use Kohya-style or diffusers PEFT format targeting Cosmos DiT blocks.
model = lora_model_from_anima_state_dict(state_dict=state_dict, alpha=None)View on GitHub (pinned to 0b6a024f2f)
Solutions
- Re-download the LoRA from its original source to rule out corruption or a bad conversion.
- Convert the LoRA state dict to diffusers FLUX key naming with an official tool (e.g. ComfyUI's flux conversion scripts or diffusers conversion utilities) before installing.
- Check config.format on the model record — it must be a supported FLUX LoRA format (e.g. LoraFormat.LyCORIS/Diffusers as accepted); reinstall the model to regenerate correct metadata.
- Verify the LoRA was trained for FLUX.1 vs FLUX.2 and that your InvokeAI version supports that family; update InvokeAI if the format is newly released.
- As a last resort, manually remap the state_dict keys to diffusers naming with a small conversion script.
Example fix
// before (config points at a BFL/unknown-format file) config = ModelRecordBase.make_config(BaseModelType.Flux, ModelFormat.Lora, path='mystery_lora.safetensors') // after (convert to diffusers naming first, then install) # python convert script: remap keys, save as diffusers-format safetensors, then reinstall via model manager
Defensive patterns
Strategy: try-catch
Validate before calling
from safetensors import safe_open
with safe_open(path, framework='pt', device='cpu') as f:
keys = list(f.keys())
is_diffusers = any(k.startswith(('transformer.', 'lora_transformer.', 'diffusion_model.')) for k in keys)
is_bfl = any('double_blocks' in k or 'single_blocks' in k for k in keys)
if not (is_diffusers or is_bfl):
raise ValueError(f"Unsupported FLUX LoRA key format, e.g. {keys[:3]}") Type guard
def is_supported_flux_lora_keys(keys: list[str]) -> bool:
return (any(k.startswith('lora_transformer.') or k.startswith('transformer.') for k in keys)
or any('double_blocks' in k or 'single_blocks' in k for k in keys)) Try / catch
try:
model = model_manager.load_model(lora_key, submodel_type=None)
except ValueError as e:
if 'unsupported FLUX format' in str(e):
converted = convert_lora_keys_to_diffusers(lora_path) # external conversion step
reinstall_model(converted)
else:
raise Prevention
- Prefer LoRAs explicitly labeled as diffusers-format for FLUX when downloading.
- Inspect safetensors key names before installing an unknown-source FLUX LoRA.
- Do not hand-edit or re-save safetensors files with ad-hoc scripts; use official conversion tools.
- Check config.format after installation matches the actual file layout.
- Keep InvokeAI updated so new FLUX LoRA formats (e.g. FLUX.2) are supported.
When it happens
Trigger: Loading a FLUX LoRA safetensors file whose keys use an unknown/legacy naming convention; a FLUX.2-style or other fork's LoRA that emits neither diffusers nor recognized BFL keys; config.format set to something unexpected for a FLUX LoRA; a truncated or hand-edited state dict.
Common situations: Downloading LoRAs from Civitai/Community sources trained with custom toolchains (e.g. older training scripts, ComfyUI-flavored exports) that use nonstandard keys; files renamed/converted with third-party scripts; using a LoRA trained for FLUX schnell/dev variants with exotic key layouts.
Related errors
- There are no submodels in a LoRA model.
- Unknown lora: {lora_key}!
- Only Qwen3VLEncoder_Checkpoint_Config models are supported h
- Unexpected submodel requested for LLaVA OneVision model.
- Unsupported IP-Adapter type: {type(self.ip_adapter)}
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/008f2368561bd986.
Report an issue: GitHub.