{"record":{"id":"ea14f78cd1c58e3c","repo":"invoke-ai/InvokeAI","slug":"the-wan-t5-encoder-must-resolve-to-a-standalone-wa","errorCode":null,"errorMessage":"The Wan T5 Encoder must resolve to a standalone Wan T5 encoder model.","messagePattern":"The Wan T5 Encoder must resolve to a standalone Wan T5 encoder model\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/wan_model_loader.py","lineNumber":282,"sourceCode":"        if self.vae_model is not None:\n            self._validate_standalone_vae(context, self.vae_model, main_variant)\n            vae = self.vae_model.model_copy(update={\"submodel_type\": SubModelType.VAE})\n        elif main_is_diffusers:\n            vae = self.model.model_copy(update={\"submodel_type\": SubModelType.VAE})\n        elif self.component_source is not None:\n            self._validate_component_source_vae(context, self.component_source, main_variant)\n            vae = self.component_source.model_copy(update={\"submodel_type\": SubModelType.VAE})\n        else:\n            raise ValueError(\n                \"No source for VAE. Either set 'VAE' to a standalone Wan VAE, \"\n                \"or set 'Component Source' to a Diffusers Wan main model.\"\n            )\n\n        # Tokenizer + text encoder: standalone override > main (if Diffusers) > component source.\n        if self.wan_t5_encoder_model is not None:\n            t5_config = context.models.get_config(self.wan_t5_encoder_model)\n            if t5_config.type != ModelType.WanT5Encoder or t5_config.format != ModelFormat.WanT5Encoder:\n                raise ValueError(\"The Wan T5 Encoder must resolve to a standalone Wan T5 encoder model.\")\n            tokenizer = self.wan_t5_encoder_model.model_copy(update={\"submodel_type\": SubModelType.Tokenizer})\n            text_encoder = self.wan_t5_encoder_model.model_copy(update={\"submodel_type\": SubModelType.TextEncoder})\n        elif main_is_diffusers:\n            tokenizer = self.model.model_copy(update={\"submodel_type\": SubModelType.Tokenizer})\n            text_encoder = self.model.model_copy(update={\"submodel_type\": SubModelType.TextEncoder})\n        elif self.component_source is not None:\n            self._validate_component_source_format(context, self.component_source)\n            tokenizer = self.component_source.model_copy(update={\"submodel_type\": SubModelType.Tokenizer})\n            text_encoder = self.component_source.model_copy(update={\"submodel_type\": SubModelType.TextEncoder})\n        else:\n            raise ValueError(\n                \"No source for Wan T5 encoder. \"\n                \"Either set 'Wan T5 Encoder' to a standalone UMT5-XXL encoder, \"\n                \"or set 'Component Source' to a Diffusers Wan main model.\"\n            )\n\n        return WanModelLoaderOutput(\n            transformer=WanTransformerField(","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/wan_model_loader.py#L264-L300","documentation":"When the 'Wan T5 Encoder' field is set, the loader validates the referenced model resolves to a config with type ModelType.WanT5Encoder and format ModelFormat.WanT5Encoder. Any other type/format means the field doesn't point at a standalone Wan T5 encoder, so invoke() raises this ValueError before building the output.","triggerScenarios":"invoke() with wan_t5_encoder_model set to a model whose config type is not WanT5Encoder or whose format is not WanT5Encoder — e.g. pointing it at a Main model, a VAE, or a T5 encoder registered with a generic format.","commonSituations":"Selecting the wrong model in the T5 encoder dropdown; an older import registered the UMT5-XXL encoder with a legacy type/format; pointing the field at a full Wan main Diffusers folder instead of the standalone encoder model.","solutions":["Set 'Wan T5 Encoder' to a standalone Wan/UMT5-XXL T5 encoder model registered with type and format WanT5Encoder","Re-import the T5 encoder so it is registered with the correct WanT5Encoder type and format","Leave the field unset and instead supply a Diffusers main model or Component Source so the tokenizer/text-encoder come from there"],"exampleFix":"// before\nwan_t5_encoder_model=ModelIdentifierField(key='some-main-model', submodel_type=SubModelType.TextEncoder)\n// after\nwan_t5_encoder_model=ModelIdentifierField(key='wan-umt5-xxl-encoder', submodel_type=SubModelType.TextEncoder)","handlingStrategy":"validation","validationCode":"if invocation.wan_t5_encoder_model is not None:\n    cfg = context.models.get_config(invocation.wan_t5_encoder_model)\n    if cfg.type != ModelType.WanT5Encoder or cfg.format != ModelFormat.WanT5Encoder:\n        raise ValueError('wan_t5_encoder_model must be a standalone Wan T5 encoder')","typeGuard":"def is_wan_t5_encoder(field, ctx) -> bool:\n    cfg = ctx.models.get_config(field)\n    return cfg.base == BaseModelType.Wan and cfg.type == ModelType.WanT5Encoder and cfg.format == ModelFormat.WanT5Encoder","tryCatchPattern":"try:\n    output = invocation.invoke(context)\nexcept ValueError as e:\n    if 'must resolve to a standalone Wan T5 encoder model' in str(e):\n        invocation.wan_t5_encoder_model = pick_umt5_xxl_encoder()","preventionTips":["Pick the T5 encoder only from the Wan T5 Encoder model-type filter in the UI","Re-scan the models directory if a recently imported encoder shows the wrong type","Never point the T5 field at a Main model or VAE"],"tags":["model-loader","wrong-model-type","wan","t5-encoder"],"backgroundTag":"wrong-model-type","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}