invoke-ai/InvokeAI · error · ValueError
Only TextEncoder and Tokenizer submodels are supported. Rece
Error message
Only TextEncoder and Tokenizer submodels are supported. Received: {submodel_str} What it means
For SDNQ Qwen3 encoder configs, _load_model only handles SubModelType.TextEncoder and SubModelType.Tokenizer. Requesting any other submodel (or None) from this loader raises a ValueError naming the received submodel type.
Source
Thrown at invokeai/backend/model_manager/load/model_loaders/z_image.py:1480
def _load_model(
self,
config: AnyModelConfig,
submodel_type: Optional[SubModelType] = None,
) -> AnyModel:
if not isinstance(config, (Qwen3Encoder_SDNQ_Config, Qwen3Encoder_SDNQ_Folder_Config)):
raise ValueError(
"Only Qwen3Encoder_SDNQ_Config or Qwen3Encoder_SDNQ_Folder_Config models are supported here."
)
match submodel_type:
case SubModelType.TextEncoder:
return self._load_from_sdnq(config)
case SubModelType.Tokenizer:
return self._load_tokenizer_with_offline_fallback()
submodel_str = submodel_type.value if submodel_type else "None"
raise ValueError(f"Only TextEncoder and Tokenizer submodels are supported. Received: {submodel_str}")
def _load_tokenizer_with_offline_fallback(self) -> AnyModel:
"""Load tokenizer with local_files_only fallback for offline support."""
try:
return AutoTokenizer.from_pretrained(self.DEFAULT_TOKENIZER_SOURCE, local_files_only=True)
except OSError:
return AutoTokenizer.from_pretrained(self.DEFAULT_TOKENIZER_SOURCE)
def _load_from_sdnq(
self,
config: AnyModelConfig,
) -> AnyModel:
from transformers import Qwen3Config, Qwen3ForCausalLM
from invokeai.backend.quantization.sdnq.sdnq_tensor import SDNQTensor
from invokeai.backend.util.logging import InvokeAILogger
logger = InvokeAILogger.get_logger(self.__class__.__name__)View on GitHub (pinned to 0b6a024f2f)
Solutions
- Load only TextEncoder/Tokenizer submodels from this config; get VAE/transformer from their own model records.
- Fix the submodel_type recorded for the model in the model manager DB (re-import the model).
- Check the calling pipeline/graph code that resolves SubModelType values.
- Guard caller code to skip unsupported submodel types for this model family.
Example fix
// before model = loader._load_model(cfg, SubModelType.Vae) // after model = loader._load_model(cfg, SubModelType.TextEncoder)
Defensive patterns
Strategy: validation
Validate before calling
SUPPORTED = {SubModelType.TextEncoder, SubModelType.Tokenizer}
if submodel_type not in SUPPORTED:
raise ValueError(f"Z-Image SDNQ encoder supports only TextEncoder/Tokenizer, got {submodel_type}") Type guard
def supports_submodel(st: SubModelType | None) -> bool:
return st in (SubModelType.TextEncoder, SubModelType.Tokenizer) Try / catch
try:
model = loader._load_model(cfg, submodel_type)
except ValueError as e:
if "Only TextEncoder and Tokenizer" in str(e):
model = load_from_other_model_record(submodel_type) # VAE/transformer live elsewhere
else:
raise Prevention
- Load each pipeline component from its own model record with the correct SubModelType.
- Fix mislabeled model types via the model manager UI (re-import).
- Assert submodel_type before calling specialized loaders.
- Remember this config family exposes only TextEncoder + Tokenizer.
When it happens
Trigger: Calling _load_model(config, submodel_type) with e.g. SubModelType.Vae, SubModelType.Main, or None for a Qwen3Encoder SDNQ config — typically a pipeline assembled the submodel list incorrectly or the model record's type is wrong.
Common situations: Model manager DB entry typed as the wrong SubModelType; custom workflow/graph node requesting the wrong submodel from this loader; API call loading submodels for a model that only exposes text encoder + tokenizer.
Related errors
- A submodel type must be provided when loading Ideogram 4 mai
- Unsupported submodel for Ideogram 4: {submodel_type.value if
- There are no submodels in an IP-Adapter model.
- Only Main_SDNQ_ZImage_Config or Main_SDNQ_Diffusers_ZImage_C
- Single-file SDNQ Z-Image checkpoints only provide the Transf
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/bd811a8074e22923.
Report an issue: GitHub.