invoke-ai/InvokeAI · error · ValueError
The {label} model must resolve to a Wan main model.
Error message
The {label} model must resolve to a Wan main model. What it means
_validate_main_config asserts that the resolved main model config has base BaseModelType.Wan and type ModelType.Main. If the selected model belongs to another base (SDXL, Flux, ...) or is not a Main model, invoke() fails with a message naming the field's label. It prevents silently feeding a foreign model into the Wan pipeline.
Source
Thrown at invokeai/app/invocations/wan_model_loader.py:312
"No source for Wan T5 encoder. "
"Either set 'Wan T5 Encoder' to a standalone UMT5-XXL encoder, "
"or set 'Component Source' to a Diffusers Wan main model."
)
return WanModelLoaderOutput(
transformer=WanTransformerField(
transformer=transformer,
transformer_low_noise=transformer_low_noise,
boundary_ratio=boundary_ratio,
),
wan_t5_encoder=WanT5EncoderField(tokenizer=tokenizer, text_encoder=text_encoder),
vae=VAEField(vae=vae),
)
@staticmethod
def _validate_main_config(config: object, label: str) -> None:
if getattr(config, "base", None) != BaseModelType.Wan or getattr(config, "type", None) != ModelType.Main:
raise ValueError(f"The {label} model must resolve to a Wan main model.")
@staticmethod
def _validate_component_source_format(context: InvocationContext, model: ModelIdentifierField) -> None:
source_config = context.models.get_config(model)
if source_config.base != BaseModelType.Wan or source_config.type != ModelType.Main:
raise ValueError("The Component Source model must resolve to a Wan main model.")
if source_config.format != ModelFormat.Diffusers:
raise ValueError(
f"The Component Source model must be in Diffusers format. "
f"The selected model '{source_config.name}' is in {source_config.format.value} format."
)
@staticmethod
def _validate_component_source_vae(
context: InvocationContext, model: ModelIdentifierField, main_variant: WanVariantType
) -> None:
WanModelLoaderInvocation._validate_component_source_format(context, model)
source_config = context.models.get_config(model)View on GitHub (pinned to 0b6a024f2f)
Solutions
- Select a Wan (base=Wan) Main model for the field named in the error label
- Re-import or edit the model's base/type metadata if it was mis-registered
- Use the main Wan model key, not a submodel key, in the invocation
Example fix
// before model=ModelIdentifierField(key='wan-vae-model', submodel_type=SubModelType.VAE) // after model=ModelIdentifierField(key='wan-main-model', submodel_type=SubModelType.Transformer)
Defensive patterns
Strategy: validation
Validate before calling
cfg = context.models.get_config(field)
if getattr(cfg, 'base', None) != BaseModelType.Wan or getattr(cfg, 'type', None) != ModelType.Main:
raise ValueError('Main model field must point at a Wan Main model') Type guard
def is_wan_main(cfg) -> bool:
return getattr(cfg, 'base', None) == BaseModelType.Wan and getattr(cfg, 'type', None) == ModelType.Main Try / catch
try:
output = invocation.invoke(context)
except ValueError as e:
if 'must resolve to a Wan main model' in str(e):
field = select_wan_main_model() # rebind the field named in the message Prevention
- Use the Wan + Main model-type filter when selecting the loader's model field
- Reference the top-level main model key, not a submodel key
- Verify model base metadata after importing
When it happens
Trigger: invoke() with the 'model' (or override) field pointing at a model whose config.base != Wan or config.type != Main — e.g. a Wan VAE, a T5 encoder, or an SD1.5 main model passed where a Wan main model is required.
Common situations: Wiring the wrong model field into the loader in a workflow; selecting a Wan transformer/VAE submodel key instead of the main model; a model whose base metadata was mis-set during import.
Related errors
- The Component Source model must resolve to a Wan main model.
- Unsupported main model format for Wan: {main_format.value}.
- The Wan T5 Encoder must resolve to a standalone Wan T5 encod
- The VAE must resolve to a standalone Wan VAE model.
- FLUX.2 [dev] loader requires a FLUX.2 [dev] transformer, but
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/c8417af6371ebed1.
Report an issue: GitHub.