invoke-ai/InvokeAI · info · NotAMatchError
missing text_encoder_2/model.safetensors.index.json
Error message
missing text_encoder_2/model.safetensors.index.json
What it means
NotAMatchError raised by T5Encoder_BnBLLMint8_Config.raise_if_doesnt_have_unquantized_config_file during model identification. The bnb LLM.int8 T5 encoder config requires a `text_encoder_2/model.safetensors.index.json` sharded-index file to positively identify the model as a FLUX-style T5 encoder; without it this candidate config declines the match. In InvokeAI's scan pipeline this is a normal probe rejection, not a crash.
Source
Thrown at invokeai/backend/model_manager/configs/t5_encoder.py:60
def from_model_on_disk(cls, mod: ModelOnDisk, override_fields: dict[str, Any]) -> Self:
raise_if_not_dir(mod)
raise_for_override_fields(cls, override_fields)
expected_config_path = mod.path / "text_encoder_2" / "config.json"
expected_class_name = "T5EncoderModel"
raise_for_class_name(expected_config_path, expected_class_name)
cls.raise_if_doesnt_have_unquantized_config_file(mod)
return cls(**override_fields)
@classmethod
def raise_if_doesnt_have_unquantized_config_file(cls, mod: ModelOnDisk) -> None:
has_unquantized_config = (mod.path / "text_encoder_2" / "model.safetensors.index.json").exists()
if not has_unquantized_config:
raise NotAMatchError("missing text_encoder_2/model.safetensors.index.json")
class T5Encoder_BnBLLMint8_Config(Config_Base):
"""Configuration for T5 Encoder models quantized by bitsandbytes' LLM.int8."""
base: Literal[BaseModelType.Any] = Field(default=BaseModelType.Any)
type: Literal[ModelType.T5Encoder] = Field(default=ModelType.T5Encoder)
format: Literal[ModelFormat.BnbQuantizedLlmInt8b] = Field(default=ModelFormat.BnbQuantizedLlmInt8b)
cpu_only: bool | None = Field(default=None, description="Whether this model should run on CPU only")
@classmethod
def from_model_on_disk(cls, mod: ModelOnDisk, override_fields: dict[str, Any]) -> Self:
raise_if_not_dir(mod)
raise_for_override_fields(cls, override_fields)
expected_config_path = mod.path / "text_encoder_2" / "config.json"
expected_class_name = "T5EncoderModel"View on GitHub (pinned to 0b6a024f2f)
Solutions
- Ensure `text_encoder_2/model.safetensors.index.json` exists at the model root (re-download the T5 encoder files from the source diffusers repo)
- If the T5 weights are a single unsharded model.safetensors, this config legitimately does not apply; let another config match or convert/reshard the model
- Verify directory layout: model_root/text_encoder_2/ must contain the index json, not a nested subfolder
Example fix
// before
flux-model/
text_encoder_2/
model-00001-of-00002.safetensors
// after
flux-model/
text_encoder_2/
model.safetensors.index.json
model-00001-of-00002.safetensors
model-00002-of-00002.safetensors Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
def has_bnb_t5_index(model_dir: Path) -> bool:
return (model_dir / "text_encoder_2" / "model.safetensors.index.json").exists() Try / catch
try:
install_model(path)
except NotAMatchError as e:
if "missing text_encoder_2/model.safetensors.index.json" in str(e):
logger.warning("T5 encoder is not a sharded llm_int8 layout; trying generic config")
install_model(path, config_path=GENERIC_T5_CONFIG) Prevention
- Download the complete diffusers repo including the sharded T5 index json
- Validate the folder layout before installing (text_encoder_2/ with index + all shards)
- Avoid renaming or moving text_encoder_2 contents
When it happens
Trigger: Calling from_model_on_disk on a model dir where (path/text_encoder_2/model.safetensors.index.json) does not exist — e.g. single-file text_encoder_2 weights, a diffusers layout using model.safetensors (unsharded), or the T5 weights stored elsewhere.
Common situations: Downloading only part of a FLUX repo (skipping sharded T5 files), converting a checkpoint to a single safetensors file, placing text_encoder_2 weights at the wrong nesting level, or manually reorganizing diffusers folders.
Related errors
- directory is not a full FLUX.2 pipeline (no model_index.json
- unrecognized scheduler prediction_type {prediction_type}
- directory looks like a full diffusers pipeline (has model_in
- directory looks like a full diffusers pipeline (has model_in
- missing text_encoder/ subfolder
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/d803fc6f67078df2.
Report an issue: GitHub.