invoke-ai/InvokeAI · error · ValueError

The Component Source model must resolve to a Wan main model.

Error message

The Component Source model must resolve to a Wan main model.

What it means

_validate_component_source_format checks that the 'Component Source' model config has base Wan and type Main before it can be mined for submodels (VAE, tokenizer, text encoder). If it resolves to any other type or base, invoke() (or _validate_component_source_vae) raises this ValueError.

Source

Thrown at invokeai/app/invocations/wan_model_loader.py:318

            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)
        source_variant = getattr(source_config, "variant", None)
        main_is_ti2v = main_variant == WanVariantType.TI2V_5B
        source_is_ti2v = source_variant == WanVariantType.TI2V_5B
        if main_is_ti2v != source_is_ti2v:
            raise ValueError(
                "The Component Source VAE is incompatible with the selected transformer. "

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Set 'Component Source' to a Wan Main model (base=Wan, type=Main)
  2. Check the model's base/type in the Model Manager and fix metadata if wrong
  3. Remove Component Source if not needed and supply standalone VAE/T5 overrides instead

Example fix

// before
component_source=ModelIdentifierField(key='wan-standalone-vae', submodel_type=SubModelType.VAE)
// after
component_source=ModelIdentifierField(key='wan-main-diffusers', submodel_type=SubModelType.Transformer)
Defensive patterns

Strategy: validation

Validate before calling

cfg = context.models.get_config(invocation.component_source)
if cfg.base != BaseModelType.Wan or cfg.type != ModelType.Main:
    raise ValueError('component_source must be a Wan Main model')

Type guard

def is_wan_main_source(field, ctx) -> bool:
    cfg = ctx.models.get_config(field)
    return cfg.base == BaseModelType.Wan and cfg.type == ModelType.Main

Try / catch

try:
    output = invocation.invoke(context)
except ValueError as e:
    if 'Component Source model must resolve to a Wan main model' in str(e):
        invocation.component_source = select_wan_main_diffusers_model()

Prevention

When it happens

Trigger: invoke() or _validate_component_source_vae() called with component_source pointing at a non-Main model (e.g. a standalone VAE or T5 encoder) or a model from another base family.

Common situations: Dropping a component model (VAE/encoder) into the Component Source field by mistake; selecting a Flux or SDXL model as component source; stale workflow referencing a deleted/re-typed model key.

Related errors


AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29). Data as JSON: /api/errors/eb10a1b487d9d678. Report an issue: GitHub.