invoke-ai/InvokeAI · error · ValueError
Only Qwen3Encoder_Qwen3Encoder_Config models are supported h
Error message
Only Qwen3Encoder_Qwen3Encoder_Config models are supported here.
What it means
This loader handles the Qwen3 text encoder used by Z-Image and requires the config to be Qwen3Encoder_Qwen3Encoder_Config. Any other config type raises this ValueError immediately, since only that config class carries the layout expectations (text_encoder/ and tokenizer/ subfolders, or a standalone text_encoder root).
Source
Thrown at invokeai/backend/model_manager/load/model_loaders/z_image.py:759
# so no BFL→diffusers conversion is needed here. The transformer has no tied/shared weights,
# so we expect a complete state dict — any missing key would leave a required parameter on a
# meta tensor and fail later during device movement or inference. Fail fast here instead.
missing, unexpected = model.load_state_dict(sd, assign=True, strict=False)
raise_on_incomplete_sdnq_load("SDNQ Z-Image transformer", missing, unexpected)
return model
@ModelLoaderRegistry.register(base=BaseModelType.Any, type=ModelType.Qwen3Encoder, format=ModelFormat.Qwen3Encoder)
class Qwen3EncoderLoader(ModelLoader):
"""Class to load standalone Qwen3 Encoder models for Z-Image (directory format)."""
def _load_model(
self,
config: AnyModelConfig,
submodel_type: Optional[SubModelType] = None,
) -> AnyModel:
if not isinstance(config, Qwen3Encoder_Qwen3Encoder_Config):
raise ValueError("Only Qwen3Encoder_Qwen3Encoder_Config models are supported here.")
model_path = Path(config.path)
# Support both structures:
# 1. Full model: model_root/text_encoder/ and model_root/tokenizer/
# 2. Standalone download: model_root/ contains text_encoder files directly
text_encoder_path = model_path / "text_encoder"
tokenizer_path = model_path / "tokenizer"
# Check if this is a standalone text_encoder download (no nested text_encoder folder)
is_standalone = not text_encoder_path.exists() and (model_path / "config.json").exists()
if is_standalone:
text_encoder_path = model_path
tokenizer_path = model_path # Tokenizer files should also be in root
match submodel_type:
case SubModelType.Tokenizer:View on GitHub (pinned to 0b6a024f2f)
Solutions
- Register the encoder-source model so it resolves to Qwen3Encoder_Qwen3Encoder_Config (standalone Qwen3 encoder download or full model with text_encoder/ + tokenizer/).
- Update the Z-Image pipeline settings to reference the correctly-typed Qwen3 encoder model.
- Re-scan the model directory so the model manager classifies the model with the right config class.
- In custom code, gate the call with isinstance(config, Qwen3Encoder_Qwen3Encoder_Config).
Example fix
// before config = Main_Checkpoint_ZImage_Config(path=p) enc = qwen3_loader._load_model(config, SubModelType.TextEncoder) # ValueError // after config = Qwen3Encoder_Qwen3Encoder_Config(path=p) # p is the Qwen3 encoder root enc = qwen3_loader._load_model(config, SubModelType.TextEncoder)
Defensive patterns
Strategy: type-guard
Validate before calling
if not isinstance(config, Qwen3Encoder_Qwen3Encoder_Config):
raise ValueError(f"Qwen3 encoder loader requires Qwen3Encoder_Qwen3Encoder_Config, got {type(config).__name__}") Type guard
def is_qwen3_encoder_config(config: AnyModelConfig) -> bool:
return isinstance(config, Qwen3Encoder_Qwen3Encoder_Config) Try / catch
try:
enc = qwen3_loader._load_model(config, SubModelType.TextEncoder)
except ValueError as e:
if "Qwen3Encoder_Qwen3Encoder_Config" in str(e):
config = reclassify_as_qwen3_encoder(config.path)
enc = qwen3_loader._load_model(config, SubModelType.TextEncoder)
else:
raise Prevention
- Point the Z-Image 'Qwen3 & VAE source model' setting at a model registered as a Qwen3 encoder, not a full checkpoint.
- Re-scan model directories after imports so configs are classified correctly.
- Verify the source model root contains text_encoder/ (and tokenizer/) files before wiring it in.
When it happens
Trigger: Calling _load_model with a config that is not Qwen3Encoder_Qwen3Encoder_Config — e.g. pointing the VAE/text-encoder source model at a checkpoint, GGUF, or SDNQ config — fails the isinstance check at z_image.py:759.
Common situations: The 'Qwen3 & VAE source model' referenced by a Z-Image pipeline was registered with the wrong model type; a full Z-Image checkpoint was selected as the encoder source instead of a Qwen3 encoder model; duplicate/mis-typed model records after re-import.
Related errors
- Expected Main_Checkpoint_ZImage_Config, got {type(config).__
- Expected Main_GGUF_ZImage_Config, got {type(config).__name__
- Expected PreTrainedModel for text encoder, got {type(text_en
- Expected PreTrainedTokenizerBase for tokenizer, got {type(to
- Only MistralEncoder_Diffusers_Config models are supported he
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/8dc71c3d2e480403.
Report an issue: GitHub.