{"record":{"id":"deb5f7359b148e21","repo":"invoke-ai/InvokeAI","slug":"the-vae-must-resolve-to-a-standalone-wan-vae-model","errorCode":null,"errorMessage":"The VAE must resolve to a standalone Wan VAE model.","messagePattern":"The VAE must resolve to a standalone Wan VAE model\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/wan_model_loader.py","lineNumber":346,"sourceCode":"    ) -> 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. \"\n                \"TI2V-5B requires the 48-channel Wan 2.2 VAE; A14B models require the 16-channel Wan 2.1 VAE.\"\n            )\n\n    @staticmethod\n    def _validate_standalone_vae(\n        context: InvocationContext, model: ModelIdentifierField, main_variant: WanVariantType\n    ) -> None:\n        vae_config = context.models.get_config(model)\n        if vae_config.base != BaseModelType.Wan or vae_config.type != ModelType.VAE:\n            raise ValueError(\"The VAE must resolve to a standalone Wan VAE model.\")\n        expected_channels = 48 if main_variant == WanVariantType.TI2V_5B else 16\n        if vae_config.latent_channels != expected_channels:\n            raise ValueError(\n                \"The standalone VAE is incompatible with the selected transformer. \"\n                \"TI2V-5B requires the 48-channel Wan 2.2 VAE; A14B models require the 16-channel Wan 2.1 VAE.\"\n            )\n","sourceCodeStart":328,"sourceCodeEnd":353,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/wan_model_loader.py#L328-L353","documentation":"_validate_standalone_vae checks that an explicitly provided VAE resolves to a config with base Wan and type VAE. If the field points at any other model kind, invoke() raises this ValueError before channel-count checks. It ensures the standalone VAE override is actually a Wan VAE model.","triggerScenarios":"invoke() with the 'VAE' field set to a model whose config.base != Wan or config.type != VAE — e.g. a SDXL VAE, a Wan Main model, or a T5 encoder placed in the VAE field.","commonSituations":"Selecting the wrong model in the VAE dropdown; reusing a workflow field that previously held a different model type; a VAE imported with incorrect type metadata.","solutions":["Set 'VAE' to a standalone Wan VAE model (base=Wan, type=VAE)","Re-import the VAE if its registered type/base metadata is wrong","Clear the override and let the loader use a Diffusers main model or Component Source for the VAE"],"exampleFix":"// before\nvae=ModelIdentifierField(key='sdxl-vae', submodel_type=SubModelType.VAE)\n// after\nvae=ModelIdentifierField(key='wan-vae', submodel_type=SubModelType.VAE)","handlingStrategy":"validation","validationCode":"if invocation.vae_model is not None:\n    cfg = context.models.get_config(invocation.vae_model)\n    if cfg.base != BaseModelType.Wan or cfg.type != ModelType.VAE:\n        raise ValueError('VAE field must point at a standalone Wan VAE')","typeGuard":"def is_standalone_wan_vae(field, ctx) -> bool:\n    cfg = ctx.models.get_config(field)\n    return cfg.base == BaseModelType.Wan and cfg.type == ModelType.VAE","tryCatchPattern":"try:\n    output = invocation.invoke(context)\nexcept ValueError as e:\n    if 'must resolve to a standalone Wan VAE model' in str(e):\n        invocation.vae_model = select_wan_vae()","preventionTips":["Select the VAE only from Wan VAE-typed models in the Model Manager","Fix base/type metadata on mis-registered VAE imports","Don't reuse VAE fields from other-base (e.g. SDXL) workflows"],"tags":["model-loader","wrong-model-type","wan","vae"],"backgroundTag":"wrong-model-type","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}