invoke-ai/InvokeAI · error · ValueError

Only Tokenizer and TextEncoder submodels are supported. Rece

Error message

Only Tokenizer and TextEncoder submodels are supported. Received: {submodel_type.value if submodel_type else 'None'}

What it means

MistralEncoderDiffusersLoader only knows how to build the Tokenizer and TextEncoder submodels; the Mistral encoder model has no VAE/UNet/etc. When _load_model is called with any other SubModelType (or None) the match statement falls through and a ValueError is raised naming the offending submodel type. This mirrors the loader's registry scope — only encoder-related submodels make sense for a text-encoder model.

Source

Thrown at invokeai/backend/model_manager/load/model_loaders/mistral_encoder.py:884

                # 30-layer cow distillation was trained against the post-layer-29
                # state *without* the final norm — swap it for Identity to match
                # ComfyUI's reference implementation. ``Mistral3ForConditionalGeneration``
                # nests the LM under ``.language_model``; handle both layouts.
                inner = getattr(model, "language_model", None) or model
                logger = InvokeAILogger.get_logger("MistralEncoderDiffusersLoader")
                _strip_final_norm_for_cow(inner, config.variant, logger)
                _warn_if_40_layer_mistral(config.variant, logger)
                # The BFL `text_encoder` checkpoint maps to `Mistral3Model`, which ships a
                # `vision_tower` + `multi_modal_projector` (~0.8GB of real weights). The
                # invocation only ever runs `.language_model`, so drop the vision path to
                # keep it out of the RAM cache and every cache->VRAM transfer. The
                # checkpoint/GGUF loaders already build a bare `MistralModel`.
                for unused in ("vision_tower", "multi_modal_projector"):
                    if getattr(model, unused, None) is not None:
                        setattr(model, unused, None)
                return model

        raise ValueError(
            "Only Tokenizer and TextEncoder submodels are supported. "
            f"Received: {submodel_type.value if submodel_type else 'None'}"
        )


@ModelLoaderRegistry.register(
    base=BaseModelType.Any,
    type=ModelType.MistralEncoder,
    format=ModelFormat.Checkpoint,
)
class MistralEncoderCheckpointLoader(ModelLoader):
    """Load a Mistral encoder from a single safetensors file (text-only)."""

    def _load_model(
        self,
        config: AnyModelConfig,
        submodel_type: Optional[SubModelType] = None,
    ) -> AnyModel:

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Only request SubModelType.Tokenizer or SubModelType.TextEncoder for MistralEncoder models; resolve VAE/denoiser etc. from the parent pipeline model instead.
  2. Pass submodel_type explicitly — do not rely on the default None value.
  3. If a pipeline builder iterates submodels, filter the loop to submodels relevant to ModelType.MistralEncoder.
  4. Upgrade InvokeAI if you believe a valid submodel is missing — the supported set is defined by the match statement in this loader.

Example fix

// before
model = loader._load_model(cfg, SubModelType.Vae)  # ValueError: Received: vae
// after
if submodel_type in (SubModelType.Tokenizer, SubModelType.TextEncoder):
    model = loader._load_model(cfg, submodel_type)
Defensive patterns

Strategy: validation

Validate before calling

VALID = {SubModelType.Tokenizer, SubModelType.TextEncoder}
if submodel_type not in VALID:
    raise ValueError(f"Mistral encoder supports only {VALID}, got {submodel_type}")
model = loader._load_model(cfg, submodel_type)

Try / catch

try:
    model = loader._load_model(cfg, submodel_type)
except ValueError as e:
    if "Only Tokenizer and TextEncoder submodels" in str(e):
        logging.warning("skipping unsupported submodel %s for MistralEncoder", submodel_type)
    else:
        raise

Prevention

When it happens

Trigger: Requesting submodels like SubModelType.Vae, SubModelType.UNet, SubModelType.Scheduler, SubModelType.CLIP*, or passing submodel_type=None when loading a MistralEncoder model through this Diffusers loader.

Common situations: Generic pipeline-loading code that iterates all submodel types for a model record without checking which submodels the model type actually exposes; copy-pasted loader code from main SD pipelines applied to the Mistral encoder; custom code calling _load_model without a submodel_type.

Related errors


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