{"record":{"id":"eb10a1b487d9d678","repo":"invoke-ai/InvokeAI","slug":"the-component-source-model-must-resolve-to-a-wan-m","errorCode":null,"errorMessage":"The Component Source model must resolve to a Wan main model.","messagePattern":"The Component Source model must resolve to a Wan main model\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/wan_model_loader.py","lineNumber":318,"sourceCode":"            transformer=WanTransformerField(\n                transformer=transformer,\n                transformer_low_noise=transformer_low_noise,\n                boundary_ratio=boundary_ratio,\n            ),\n            wan_t5_encoder=WanT5EncoderField(tokenizer=tokenizer, text_encoder=text_encoder),\n            vae=VAEField(vae=vae),\n        )\n\n    @staticmethod\n    def _validate_main_config(config: object, label: str) -> None:\n        if getattr(config, \"base\", None) != BaseModelType.Wan or getattr(config, \"type\", None) != ModelType.Main:\n            raise ValueError(f\"The {label} model must resolve to a Wan main model.\")\n\n    @staticmethod\n    def _validate_component_source_format(context: InvocationContext, model: ModelIdentifierField) -> None:\n        source_config = context.models.get_config(model)\n        if source_config.base != BaseModelType.Wan or source_config.type != ModelType.Main:\n            raise ValueError(\"The Component Source model must resolve to a Wan main model.\")\n        if source_config.format != ModelFormat.Diffusers:\n            raise ValueError(\n                f\"The Component Source model must be in Diffusers format. \"\n                f\"The selected model '{source_config.name}' is in {source_config.format.value} format.\"\n            )\n\n    @staticmethod\n    def _validate_component_source_vae(\n        context: InvocationContext, model: ModelIdentifierField, main_variant: WanVariantType\n    ) -> None:\n        WanModelLoaderInvocation._validate_component_source_format(context, model)\n        source_config = context.models.get_config(model)\n        source_variant = getattr(source_config, \"variant\", None)\n        main_is_ti2v = main_variant == WanVariantType.TI2V_5B\n        source_is_ti2v = source_variant == WanVariantType.TI2V_5B\n        if main_is_ti2v != source_is_ti2v:\n            raise ValueError(\n                \"The Component Source VAE is incompatible with the selected transformer. \"","sourceCodeStart":300,"sourceCodeEnd":336,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/wan_model_loader.py#L300-L336","documentation":"_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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set 'Component Source' to a Wan Main model (base=Wan, type=Main)","Check the model's base/type in the Model Manager and fix metadata if wrong","Remove Component Source if not needed and supply standalone VAE/T5 overrides instead"],"exampleFix":"// before\ncomponent_source=ModelIdentifierField(key='wan-standalone-vae', submodel_type=SubModelType.VAE)\n// after\ncomponent_source=ModelIdentifierField(key='wan-main-diffusers', submodel_type=SubModelType.Transformer)","handlingStrategy":"validation","validationCode":"cfg = context.models.get_config(invocation.component_source)\nif cfg.base != BaseModelType.Wan or cfg.type != ModelType.Main:\n    raise ValueError('component_source must be a Wan Main model')","typeGuard":"def is_wan_main_source(field, ctx) -> bool:\n    cfg = ctx.models.get_config(field)\n    return cfg.base == BaseModelType.Wan and cfg.type == ModelType.Main","tryCatchPattern":"try:\n    output = invocation.invoke(context)\nexcept ValueError as e:\n    if 'Component Source model must resolve to a Wan main model' in str(e):\n        invocation.component_source = select_wan_main_diffusers_model()","preventionTips":["Only ever fill Component Source with a Wan Main model","Don't confuse the Component Source field with the VAE or T5 override fields","Re-check bindings when reusing workflows across model installs"],"tags":["model-loader","wrong-model-type","wan","validation"],"backgroundTag":"wrong-model-type","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}