invoke-ai/InvokeAI · error · ValueError

Unknown lora: {lora.lora.key}!

Error message

Unknown lora: {lora.lora.key}!

What it means

This is the bulk-validation path in invoke(): after copying transformer/encoder models, it iterates over all incoming lora entries and, for each, checks context.models.exists(lora.lora.key). Any entry whose model key is missing from the model manager raises ValueError('Unknown lora: ...'). It ensures every LoRA reference in the aggregated list points to a registered model before config lookup.

Source

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

        default=None,
        title="Qwen3-VL Encoder",
        description=FieldDescriptions.qwen3_vl_encoder,
        input=Input.Connection,
    )

    def invoke(self, context: InvocationContext) -> Krea2LoRALoaderOutput:
        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 = (

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Open the workflow and re-select the missing LoRA in the loader node to bind a fresh valid key.
  2. Re-install/re-import the referenced LoRA file so a model record with that key (or a new key) exists.
  3. Compare the failing key against GET /api/v1/models to confirm it is absent, then update the graph accordingly.
  4. Pre-validate all lora.lora.key values with context.models.exists() and skip or substitute missing entries before invoking.

Example fix

// before
loras = [LoRAField(lora=ModelIdentifierField(key="gone-123"), weight=0.7)]
// after: validate keys first
loras = [l for l in loras if context.models.exists(l.lora.key)]  # or re-bind keys from model manager
Defensive patterns

Strategy: validation

Validate before calling

missing = [l.lora.key for l in loras if l is not None and not context.models.exists(l.lora.key)]
if missing:
    raise LookupError(f"Missing LoRA model records: {missing} - re-import or re-select before invoking")

Try / catch

try:
    output = loader.invoke(context)
except ValueError as e:
    if str(e).startswith("Unknown lora:"):
        missing_key = str(e).split(":")[1].strip().rstrip("!")
        loras = substitute_lora(loras, missing_key, default_krea2_lora_key)
        output = loader.model_copy(update={"loras": loras}).invoke(context)
    else:
        raise

Prevention

When it happens

Trigger: invoke() on a Krea2 loader invocation whose loras list contains a LoRAField with a key absent from the model manager store (deleted model, stale workflow reference, cross-install copy).

Common situations: Shared workflows referencing models that were never installed on the target machine; model manager database rebuilt/reimported so keys changed; pruning unused models from disk without updating saved graphs.

Related errors


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