invoke-ai/InvokeAI · error · ValueError

Encoder '{encoder_config.name}' is not a Qwen3-VL encoder co

Error message

Encoder '{encoder_config.name}' is not a Qwen3-VL encoder compatible with Krea-2.

What it means

Krea-2 conditions on a Qwen3-VL text encoder. If a standalone encoder model is provided to Krea2ModelLoader, its config type must be ModelType.Qwen3VLEncoder; anything else is rejected with this ValueError during invoke().

Source

Thrown at invokeai/app/invocations/krea2_model_loader.py:104

        if self.vae_model is not None:
            vae_config = context.models.get_config(self.vae_model)
            if vae_config.type is not ModelType.VAE or vae_config.base not in (
                BaseModelType.QwenImage,
                BaseModelType.Anima,
            ):
                raise ValueError(
                    f"VAE '{vae_config.name}' is not compatible with Krea-2. Select a Qwen Image or Anima VAE."
                )
            vae = self.vae_model.model_copy(update={"submodel_type": SubModelType.VAE})
        else:
            self._validate_diffusers_format(context, self.model, "Krea-2")
            vae = self.model.model_copy(update={"submodel_type": SubModelType.VAE})

        # Determine Qwen3-VL Encoder source.
        if self.qwen3_vl_encoder_model is not None:
            encoder_config = context.models.get_config(self.qwen3_vl_encoder_model)
            if encoder_config.type is not ModelType.Qwen3VLEncoder:
                raise ValueError(f"Encoder '{encoder_config.name}' is not a Qwen3-VL encoder compatible with Krea-2.")
            tokenizer = self.qwen3_vl_encoder_model.model_copy(update={"submodel_type": SubModelType.Tokenizer})
            text_encoder = self.qwen3_vl_encoder_model.model_copy(update={"submodel_type": SubModelType.TextEncoder})
        else:
            self._validate_diffusers_format(context, self.model, "Krea-2")
            tokenizer = self.model.model_copy(update={"submodel_type": SubModelType.Tokenizer})
            text_encoder = self.model.model_copy(update={"submodel_type": SubModelType.TextEncoder})

        return Krea2ModelLoaderOutput(
            transformer=TransformerField(transformer=transformer, loras=[]),
            qwen3_vl_encoder=Qwen3VLEncoderField(tokenizer=tokenizer, text_encoder=text_encoder, loras=[]),
            vae=VAEField(vae=vae),
        )

    def _validate_diffusers_format(
        self, context: InvocationContext, model: ModelIdentifierField, model_name: str
    ) -> None:
        """Validate that a model is in Diffusers format (required to extract VAE / encoder submodels)."""
        config = context.models.get_config(model)

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Select a model whose type is Qwen3VLEncoder for the qwen3_vl_encoder_model field.
  2. Leave qwen3_vl_encoder_model unset to extract the encoder from a Diffusers-format Krea-2 main model.
  3. Re-import the encoder in the model manager so it is classified as a Qwen3VLEncoder model.

Example fix

// before
Krea2ModelLoader(model=krea2_main, qwen3_vl_encoder_model=t5_encoder_model)
// after
Krea2ModelLoader(model=krea2_main, qwen3_vl_encoder_model=qwen3_vl_encoder)  # type=Qwen3VLEncoder
Defensive patterns

Strategy: validation

Validate before calling

if encoder_field is not None:
    cfg = context.models.get_config(encoder_field)
    if cfg.type is not ModelType.Qwen3VLEncoder:
        raise ValueError(f"{cfg.name} is not a Qwen3-VL encoder")

Type guard

from invokeai.backend.model_manager.config import ModelType

def is_qwen3vl_encoder(cfg) -> bool:
    return cfg.type is ModelType.Qwen3VLEncoder

Try / catch

try:
    output = loader.invoke(context)
except ValueError as e:
    if "Qwen3-VL encoder" in str(e):
        output = loader.model_copy(update={"qwen3_vl_encoder_model": None}).invoke(context)
    else:
        raise

Prevention

When it happens

Trigger: Setting Krea2ModelLoader.qwen3_vl_encoder_model to a model record whose type is not ModelType.Qwen3VLEncoder (e.g. a generic Main model, CLIP/T5 encoder, or VAE record).

Common situations: Selecting a text encoder from another model family (CLIP, T5, Gemma) in the node dropdown; an encoder imported without the Qwen3VLEncoder type classification; copying a ModelIdentifierField from a non-Krea-2 workflow.

Related errors


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