invoke-ai/InvokeAI · error · ValueError

LoRA '{lora.lora.key}' is for {stored_config.base.value if s

Error message

LoRA '{lora.lora.key}' is for {stored_config.base.value if stored_config.base else 'unknown'} models, not Krea-2 models. Ensure you are using a Krea-2 compatible LoRA.

What it means

In the per-lora loop of invoke(), after confirming the model exists, it validates that lora.lora.base is BaseModelType.Krea2, the stored config's base is Krea2, and the stored type is ModelType.LoRA. Any mismatch raises this ValueError, telling the user the referenced model is not a Krea-2 compatible LoRA (wrong architecture or wrong model type).

Source

Thrown at invokeai/app/invocations/krea2_lora_loader.py:151

        output = Krea2LoRALoaderOutput()
        loras = self.loras if isinstance(self.loras, list) else [self.loras]
        if self.transformer is not None:
            output.transformer = self.transformer.model_copy(deep=True)
        if self.qwen3_vl_encoder is not None:
            output.qwen3_vl_encoder = self.qwen3_vl_encoder.model_copy(deep=True)

        for lora in loras:
            if lora is None:
                continue
            if not context.models.exists(lora.lora.key):
                raise ValueError(f"Unknown lora: {lora.lora.key}!")
            stored_config = context.models.get_config(lora.lora.key)
            if (
                lora.lora.base is not BaseModelType.Krea2
                or stored_config.base is not BaseModelType.Krea2
                or stored_config.type is not ModelType.LoRA
            ):
                raise ValueError(
                    f"LoRA '{lora.lora.key}' is for "
                    f"{stored_config.base.value if stored_config.base else 'unknown'} models, "
                    "not Krea-2 models. Ensure you are using a Krea-2 compatible LoRA."
                )

            transformer_lora = (
                next((item for item in output.transformer.loras if item.lora.key == lora.lora.key), None)
                if output.transformer is not None
                else None
            )
            encoder_lora = (
                next((item for item in output.qwen3_vl_encoder.loras if item.lora.key == lora.lora.key), None)
                if output.qwen3_vl_encoder is not None
                else None
            )
            if (
                transformer_lora is not None
                and encoder_lora is not None

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Replace the offending LoRA with one trained for Krea-2 (base=Krea2, type=LoRA).
  2. Re-import the model so the Model Manager re-detects correct base/type metadata.
  3. Edit the model's stored config in the Model Manager if the file is Krea2 but was misclassified.
  4. Filter the loras list before invoking, keeping only entries whose base is Krea2, or surface a warning to the user instead of failing.

Example fix

// before
loras = [LoRAField(lora=ModelIdentifierField(key="sdxl-lora"), weight=0.6)]
// after: only Krea2 LoRAs
loras = [l for l in loras if l.lora.base == BaseModelType.Krea2]
Defensive patterns

Strategy: validation

Validate before calling

from invokeai.backend.model_manager.config import BaseModelType, ModelType
for lora in loras:
    if lora is None:
        continue
    if lora.lora.base is not BaseModelType.Krea2:
        raise ValueError(f"{lora.lora.key} base={lora.lora.base}, expected Krea2")
    cfg = context.models.get_config(lora.lora.key)
    if cfg.base is not BaseModelType.Krea2 or cfg.type is not ModelType.LoRA:
        raise ValueError(f"{lora.lora.key} is {cfg.base.value}/{cfg.type.value}, not a Krea2 LoRA")

Type guard

def is_krea2_lora_entry(lora) -> bool:
    if lora is None:
        return True
    cfg = get_stored_config(lora.lora.key)
    return (
        lora.lora.base is BaseModelType.Krea2
        and cfg is not None
        and cfg.base is BaseModelType.Krea2
        and cfg.type is ModelType.LoRA
    )

Try / catch

try:
    output = loader.invoke(context)
except ValueError as e:
    if "not Krea-2 models" in str(e):
        raise UserInputError("One of the LoRAs in this stack is not Krea-2 compatible; remove or replace it") from e
    raise

Prevention

When it happens

Trigger: invoke() where any entry in the loras list has base != BaseModelType.Krea2, or its stored_config.base != BaseModelType.Krea2, or stored_config.type != ModelType.LoRA.

Common situations: Mixing LoRAs trained for SD1.5/SDXL/Flux into a Krea-2 stack; models misdetected at import so metadata (base/type) is wrong; stale model configs after InvokeAI upgrades that changed base type names.

Related errors


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