invoke-ai/InvokeAI · error · NotAMatchError

model state dict does not look like a Flux Control LoRA

Error message

model state dict does not look like a Flux Control LoRA

What it means

NotAMatchError raised by ControlLoRA_LyCORIS_FLUX_Config._validate_looks_like_control_lora when the loaded state dict fails is_state_dict_likely_flux_control, i.e. the file does not carry the distinctive key/shape signature of a FLUX Control LoRA (a ControlNet-style adapter, not an ordinary style LoRA). Thrown from from_model_on_disk so the probe falls through to other LoRA configs.

Source

Thrown at invokeai/backend/model_manager/configs/lora.py:1216

    trigger_phrases: set[str] | None = Field(None)

    @classmethod
    def from_model_on_disk(cls, mod: ModelOnDisk, override_fields: dict[str, Any]) -> Self:
        raise_if_not_file(mod)

        raise_for_override_fields(cls, override_fields)

        cls._validate_looks_like_control_lora(mod)

        return cls(**override_fields)

    @classmethod
    def _validate_looks_like_control_lora(cls, mod: ModelOnDisk) -> None:
        state_dict = mod.load_state_dict()

        if not is_state_dict_likely_flux_control(state_dict):
            raise NotAMatchError("model state dict does not look like a Flux Control LoRA")


class LoRA_Diffusers_Config_Base(LoRA_Config_Base):
    """Model config for LoRA/Diffusers models."""

    # TODO(psyche): Needs base handling. For FLUX, the Diffusers format does not indicate a folder model; it indicates
    # the weights format. FLUX Diffusers LoRAs are single files.

    format: Literal[ModelFormat.Diffusers] = Field(default=ModelFormat.Diffusers)

    @classmethod
    def from_model_on_disk(cls, mod: ModelOnDisk, override_fields: dict[str, Any]) -> Self:
        raise_if_not_dir(mod)

        raise_for_override_fields(cls, override_fields)

        cls._validate_base(mod)

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. If the file is a plain style LoRA, this error is benign probe fall-through — ensure the correct config class eventually matches it; check that installation completes with the right type (LoRA, not ControlLoRa).
  2. Confirm you downloaded the FLUX variant of the Control LoRA (not SD/SDXL), and from a source using the expected key layout.
  3. Inspect state-dict keys and compare with is_state_dict_likely_flux_control's expectations; re-save with original tooling if a converter renamed keys.
  4. Set the model type explicitly during install (e.g. override_fields type) if auto-detection misroutes a known file.

Example fix

// before: installing an SDXL control-LoRA file into a FLUX install
// after: download the FLUX control lora, e.g.
// invokeai-install --model https://.../flux-control-lora.safetensors  # FLUX variant, not sdxl_control.safetensors
Defensive patterns

Strategy: validation

Validate before calling

from safetensors.torch import load_file
from invokeai.backend.model_manager.util import is_state_dict_likely_flux_control  # wherever exported
sd = load_file(path)
if not is_state_dict_likely_flux_control(sd):
    raise ValueError(f'{path} is not a FLUX Control LoRA; install as a regular LoRA or check the variant')

Type guard

def is_flux_control_lora_file(path: str) -> bool:
    from invokeai.backend.model_manager.util import is_state_dict_likely_flux_control
    sd = load_file(path)
    return is_state_dict_likely_flux_control(sd)

Try / catch

try:
    install_as_control_lora(path)
except NotAMatchError:
    logger.info('%s is not a FLUX Control LoRA; falling back to regular LoRA install', path)
    install_as_lora(path)

Prevention

When it happens

Trigger: Probing a single-file LoRA via ControlLoRA_LyCORIS_FLUX_Config.from_model_on_disk where mod.load_state_dict() keys do not satisfy is_state_dict_likely_flux_control — typically an ordinary FLUX LoRA, a non-FLUX Control LoRA, or a ControlNet model saved in a different layout.

Common situations: Installing a regular FLUX LoRA that the router tries against the Control-LoRA class first (the error is expected fall-through behavior); downloading a 'control' LoRA trained for SD/SDXL rather than FLUX; a FLUX Control LoRA re-saved by a tool that renamed its distinctive keys.

Related errors


AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29). Data as JSON: /api/errors/14d170f0ff84ac5d. Report an issue: GitHub.