invoke-ai/InvokeAI · error · ValueError
Only MistralEncoder_Diffusers_Config models are supported he
Error message
Only MistralEncoder_Diffusers_Config models are supported here.
What it means
MistralEncoderDiffusersLoader._load_model asserts that the config record it was handed is a MistralEncoder_Diffusers_Config before touching config.path. This loader is registered for ModelType.MistralEncoder with format MistralEncoder, so the registry should only route Diffusers-style Mistral encoder records here; a ValueError is raised when some other config subclass (e.g. checkpoint or GGUF config) is passed programmatically or the registry dispatch is bypassed. It is an internal invariant/argument-validation error, not a data-corruption issue.
Source
Thrown at invokeai/backend/model_manager/load/model_loaders/mistral_encoder.py:836
@ModelLoaderRegistry.register(
base=BaseModelType.Any,
type=ModelType.MistralEncoder,
format=ModelFormat.MistralEncoder,
)
class MistralEncoderDiffusersLoader(ModelLoader):
"""Load a Mistral text encoder from a HuggingFace folder layout.
Handles both the full FLUX.2-dev pipeline layout (with sibling ``tokenizer/``)
and a standalone download where ``text_encoder/`` files live at the root.
"""
def _load_model(
self,
config: AnyModelConfig,
submodel_type: Optional[SubModelType] = None,
) -> AnyModel:
if not isinstance(config, MistralEncoder_Diffusers_Config):
raise ValueError("Only MistralEncoder_Diffusers_Config models are supported here.")
model_path = Path(config.path)
text_encoder_path = model_path / "text_encoder"
# Standalone download: text_encoder files at the root.
if not text_encoder_path.exists() and (model_path / "config.json").exists():
text_encoder_path = model_path
target_device = TorchDevice.choose_torch_device()
model_dtype = TorchDevice.choose_bfloat16_safe_dtype(target_device)
match submodel_type:
case SubModelType.Tokenizer:
logger = InvokeAILogger.get_logger("MistralEncoderProcessor")
# Let the multi-strategy loader own the full ladder: embedded Tekken,
# sibling tokenizer/, root-level processor files, then the HF fallback.
return _load_tokenizer_for_model(model_path, logger)
case SubModelType.TextEncoder:View on GitHub (pinned to 0b6a024f2f)
Solutions
- Pass a config record created for a Diffusers-format Mistral encoder (MistralEncoder_Diffusers_Config, i.e. a folder layout with text_encoder/ or root config.json), not a single-file checkpoint or GGUF.
- If loading a single .safetensors checkpoint or GGUF file, let the model manager route to MistralEncoderCheckpointLoader / MistralEncoderGGUFLoader instead of calling this loader.
- Check how the config record was created/imported — re-scan or re-import the model so InvokeAI derives the correct config class from the actual file layout.
- If you must call the loader directly, wrap the call in isinstance(config, MistralEncoder_Diffusers_Config) before invoking.
Example fix
// before loader = MistralEncoderDiffusersLoader(...) model = loader._load_model(checkpoint_cfg, SubModelType.TextEncoder) # ValueError // after from invokeai.backend.model_manager.configs.mistral import MistralEncoder_Diffusers_Config assert isinstance(cfg, MistralEncoder_Diffusers_Config), "use the checkpoint/GGUF loader for this file" model = loader._load_model(cfg, SubModelType.TextEncoder)
Defensive patterns
Strategy: type-guard
Validate before calling
from invokeai.backend.model_manager.configs.factory import AnyModelConfig
from invokeai.backend.model_manager.configs.mistral import MistralEncoder_Diffusers_Config
def can_load_with_diffusers_loader(cfg: AnyModelConfig) -> bool:
return isinstance(cfg, MistralEncoder_Diffusers_Config) Type guard
def is_mistral_diffusers_config(cfg: AnyModelConfig) -> TypeGuard[MistralEncoder_Diffusers_Config]:
return isinstance(cfg, MistralEncoder_Diffusers_Config) Try / catch
try:
model = loader._load_model(cfg, SubModelType.TextEncoder)
except ValueError as e:
if "Only MistralEncoder_Diffusers_Config" in str(e):
model = pick_loader_for_config(cfg)._load_model(cfg, SubModelType.TextEncoder)
else:
raise Prevention
- Never call model loaders directly; go through the ModelManager so the registry dispatches by type/format.
- When constructing configs programmatically, use the factory/scan helpers so the config class matches the file layout.
- Add an isinstance assert before custom loader calls.
When it happens
Trigger: Calling MistralEncoderDiffusersLoader._load_model directly with a config that is not MistralEncoder_Diffusers_Config (e.g. a MistralEncoder_Checkpoint_Config or MistralEncoder_GGUF_Config record), or custom code that constructs/injects model configs whose 'type/format' fields resolve to this loader while the config class differs.
Common situations: Custom scripts or plugins that build model config records by hand and load them outside the normal ModelManager install/load flow; a merged or edited models.yaml/DB row whose config class no longer matches its declared format; testing the loader with a mocked AnyModelConfig.
Related errors
- Only MistralEncoder_Checkpoint_Config models are supported h
- Only MistralEncoder_GGUF_Config models are supported here.
- Only Tokenizer and TextEncoder submodels are supported. Rece
- A submodel type must be provided when loading onnx pipelines
- Unrecognised PiD decoder checkpoint extension: {suffix!r}
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/bc017f1f738faa44.
Report an issue: GitHub.