invoke-ai/InvokeAI · error · ValueError

Unknown lora: {self.lora.key}!

Error message

Unknown lora: {self.lora.key}!

What it means

The FLUX Control LoRA loader checks context.models.exists(self.lora.key) before loading; when the key is not in the model manager it raises this ValueError. It means the LoRA model record referenced by the ModelIdentifierField no longer exists (deleted, renamed, or from another install).

Source

Thrown at invokeai/app/invocations/flux_control_lora_loader.py:43

    tags=["lora", "model", "flux"],
    category="model",
    version="1.1.1",
)
class FluxControlLoRALoaderInvocation(BaseInvocation):
    """LoRA model and Image to use with FLUX transformer generation."""

    lora: ModelIdentifierField = InputField(
        description=FieldDescriptions.control_lora_model,
        title="Control LoRA",
        ui_model_base=BaseModelType.Flux,
        ui_model_type=ModelType.ControlLoRa,
    )
    image: ImageField = InputField(description="The image to encode.")
    weight: float = InputField(description="The weight of the LoRA.", default=1.0)

    def invoke(self, context: InvocationContext) -> FluxControlLoRALoaderOutput:
        if not context.models.exists(self.lora.key):
            raise ValueError(f"Unknown lora: {self.lora.key}!")

        return FluxControlLoRALoaderOutput(
            control_lora=ControlLoRAField(
                lora=self.lora,
                img=self.image,
                weight=self.weight,
            )
        )

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Re-select the LoRA in the workflow so the node gets a fresh valid key
  2. Install the referenced LoRA via the model manager on this machine
  3. Verify the key exists with the model manager UI/API before running
  4. Re-scan the models directory if records are out of sync

Example fix

// before: stale key from another install
lora=ModelIdentifierField(key='abc-old-install-key')
// after: re-selected in UI on current install
lora=ModelIdentifierField(key='flux-control-lora-local-123')
Defensive patterns

Strategy: validation

Validate before calling

if not context.models.exists(lora_field.key):
    raise ValueError(f'LoRA {lora_field.key} not installed; re-select it in the workflow')

Type guard

def lora_is_available(context, lora_field) -> bool:
    return context.models.exists(lora_field.key)

Try / catch

try:
    result = control_lora_loader.invoke(context)
except ValueError as e:
    if 'Unknown lora' in str(e):
        reinstall_or_reselect_lora()
    raise

Prevention

When it happens

Trigger: self.lora.key not found in context.models at invoke time; passing a stale ModelIdentifierField captured before model deletion; loading a saved workflow referencing LoRAs not installed on the machine.

Common situations: Sharing workflows between machines with different model installs; LoRA deleted/renamed after the workflow was saved; key format changes after an InvokeAI upgrade or model-manager migration.

Related errors


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