invoke-ai/InvokeAI · error · ValueError

Only MistralEncoder_GGUF_Config models are supported here.

Error message

Only MistralEncoder_GGUF_Config models are supported here.

What it means

MistralEncoderGGUFLoader._load_model (GGUF-quantized Mistral encoder format) asserts isinstance(config, MistralEncoder_GGUF_Config) and raises ValueError otherwise. Only GGUF config records may reach this loader; a Diffusers-folder or single-file checkpoint config indicates the caller bypassed the registry dispatch or the config record's format/class are inconsistent.

Source

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

        return model


@ModelLoaderRegistry.register(
    base=BaseModelType.Any,
    type=ModelType.MistralEncoder,
    format=ModelFormat.GGUFQuantized,
)
class MistralEncoderGGUFLoader(ModelLoader):
    """Load a GGUF-quantized Mistral encoder (text-only)."""

    def _load_model(
        self,
        config: AnyModelConfig,
        submodel_type: Optional[SubModelType] = None,
    ) -> AnyModel:
        if not isinstance(config, MistralEncoder_GGUF_Config):
            raise ValueError("Only MistralEncoder_GGUF_Config models are supported here.")

        match submodel_type:
            case SubModelType.TextEncoder:
                return self._load_from_gguf(config)
            case SubModelType.Tokenizer:
                logger = InvokeAILogger.get_logger("MistralEncoderProcessor")
                return _load_tokenizer_for_model(Path(config.path), logger)

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

    def _load_from_gguf(self, config: MistralEncoder_GGUF_Config) -> AnyModel:
        logger = InvokeAILogger.get_logger(self.__class__.__name__)
        target_device = TorchDevice.choose_torch_device()
        compute_dtype = TorchDevice.choose_bfloat16_safe_dtype(target_device)

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Pass a MistralEncoder_GGUF_Config whose path points to the .gguf file.
  2. Use the model manager so the registry picks the loader matching the config's format instead of calling this class directly.
  3. For safetensors checkpoints use MistralEncoderCheckpointLoader; for HF folders use MistralEncoderDiffusersLoader.
  4. Re-scan/re-import the model so the config class matches the actual file format.

Example fix

// before
model = gguf_loader._load_model(diffusers_cfg, SubModelType.TextEncoder)  # ValueError
// after
from invokeai.backend.model_manager.configs.mistral import MistralEncoder_GGUF_Config
assert isinstance(cfg, MistralEncoder_GGUF_Config)
model = gguf_loader._load_model(cfg, SubModelType.TextEncoder)
Defensive patterns

Strategy: type-guard

Validate before calling

from invokeai.backend.model_manager.configs.mistral import MistralEncoder_GGUF_Config

def can_load_with_gguf_loader(cfg: AnyModelConfig) -> bool:
    return isinstance(cfg, MistralEncoder_GGUF_Config)

Type guard

def is_mistral_gguf_config(cfg: AnyModelConfig) -> TypeGuard[MistralEncoder_GGUF_Config]:
    return isinstance(cfg, MistralEncoder_GGUF_Config)

Try / catch

try:
    model = loader._load_model(cfg, SubModelType.TextEncoder)
except ValueError as e:
    if "Only MistralEncoder_GGUF_Config" in str(e):
        model = registry_loader_for(cfg)._load_model(cfg, SubModelType.TextEncoder)
    else:
        raise

Prevention

When it happens

Trigger: Calling MistralEncoderGGUFLoader._load_model with MistralEncoder_Diffusers_Config, MistralEncoder_Checkpoint_Config, or any non-GGUF AnyModelConfig — typically via direct loader invocation or hand-built config records.

Common situations: Scripts that force a .gguf file through the wrong loader class; test harnesses with mocked configs; model records whose declared format was edited (e.g. from Checkpoint to GGUFQuantized) without re-generating the config class.

Related errors


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