{"record":{"id":"ef867d8ccd33feb6","repo":"invoke-ai/InvokeAI","slug":"lora-lora-config-name-is-a-lora-variant-value","errorCode":null,"errorMessage":"LoRA '{lora_config.name}' is a {lora_variant.value} LoRA and cannot be applied via the FLUX.2 [dev] loader. Use the FLUX.2 Klein LoRA loader for Klein LoRAs.","messagePattern":"LoRA '(.+?)' is a (.+?) LoRA and cannot be applied via the FLUX\\.2 \\[dev\\] loader\\. Use the FLUX\\.2 Klein LoRA loader for Klein LoRAs\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/flux2_dev_lora_loader.py","lineNumber":40,"sourceCode":")\nfrom invokeai.app.services.shared.invocation_context import InvocationContext\nfrom invokeai.backend.model_manager.taxonomy import BaseModelType, Flux2VariantType, ModelType\n\n\ndef _assert_dev_lora(context: InvocationContext, lora_config) -> None:\n    \"\"\"Reject a non-dev FLUX.2 LoRA applied via the FLUX.2 [dev] loaders.\n\n    A Klein LoRA (hidden 3072/4096) applied to a dev transformer/encoder (hidden 5120/6144)\n    is guaranteed to raise a shape-mismatch ``RuntimeError`` partway through denoise. Fail\n    fast here with an actionable message instead. This is independent of *which* input the\n    LoRA is wired to — the mismatch happens on whichever module it patches — so the check\n    is not gated on the transformer being connected. The frontend also filters these out\n    before they reach the graph (see ``addFlux2DevLoRAs``); this is the backend backstop for\n    hand-built workflow graphs.\n    \"\"\"\n    lora_variant = getattr(lora_config, \"variant\", None)\n    if lora_variant is not None and lora_variant != Flux2VariantType.Dev:\n        raise ValueError(\n            f\"LoRA '{lora_config.name}' is a {lora_variant.value} LoRA and cannot be applied via the \"\n            \"FLUX.2 [dev] loader. Use the FLUX.2 Klein LoRA loader for Klein LoRAs.\"\n        )\n\n\n@invocation_output(\"flux2_dev_lora_loader_output\")\nclass Flux2DevLoRALoaderOutput(BaseInvocationOutput):\n    \"\"\"FLUX.2 [dev] LoRA loader output.\"\"\"\n\n    transformer: Optional[TransformerField] = OutputField(\n        default=None, description=FieldDescriptions.transformer, title=\"Transformer\"\n    )\n    mistral_encoder: Optional[MistralEncoderField] = OutputField(\n        default=None, description=FieldDescriptions.mistral_encoder, title=\"Mistral Encoder\"\n    )\n\n\n@invocation(","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/flux2_dev_lora_loader.py#L22-L58","documentation":"_assert_dev_lora is a backend backstop ensuring only FLUX.2 [dev] variant LoRAs reach the dev loader. If the LoRA model config's variant is set (e.g. Klein) and is not Flux2VariantType.Dev, the loader refuses to apply it because it would shape-error at denoise time.","triggerScenarios":"invoking Flux2DevLoRALoaderInvocation whose self.lora resolves (via context.models.get_config) to a model config with variant != Dev, e.g. a FLUX.2 Klein LoRA wired into the dev loader.","commonSituations":"Hand-building workflow graphs (frontend normally filters via addFlux2DevLoRAs); switching the main model from dev to Klein but keeping dev loader nodes; downloading a Klein LoRA and wiring it into the dev LoRA loader node.","solutions":["Use the FLUX.2 Klein LoRA loader invocation instead of the dev loader for this LoRA","Or select a FLUX.2 [dev] variant LoRA in the dev loader's lora field","Check the model's variant in Model Manager and fix mismatched loader nodes in the graph"],"exampleFix":"# before\nloader = Flux2DevLoRALoaderInvocation(lora=klein_lora_key, transformer=x)\n# after\nloader = Flux2KleinLoRALoaderInvocation(lora=klein_lora_key, transformer=x)","handlingStrategy":"validation","validationCode":"cfg = context.models.get_config(lora_key)\nvariant = getattr(cfg, 'variant', None)\nif variant is not None and variant != Flux2VariantType.Dev:\n    raise ValueError(f'{cfg.name} is {variant.value}, not Dev')","typeGuard":"def is_dev_lora(cfg) -> bool:\n    v = getattr(cfg, 'variant', None)\n    return v is None or v == Flux2VariantType.Dev","tryCatchPattern":"try:\n    out = loader.invoke(context)\nexcept ValueError as e:\n    if 'Use the FLUX.2 Klein LoRA loader' in str(e):\n        out = klein_loader.invoke(context)  # swap loader node\n    else:\n        raise","preventionTips":["Match LoRA variant to the loader node family when building graphs","Check variant in Model Manager before wiring dev loaders","Let the frontend's addFlux2DevLoRAs filter instead of hand-editing graph JSON"],"tags":["validation","lora","flux2","model-variant"],"backgroundTag":"lora-variant-mismatch","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}