{"record":{"id":"5540f76e81fa2dec","repo":"invoke-ai/InvokeAI","slug":"unsupported-main-model-format-for-wan-main-forma","errorCode":null,"errorMessage":"Unsupported main model format for Wan: {main_format.value}. Use a Diffusers folder, a GGUF file, or a single-file safetensors checkpoint.","messagePattern":"Unsupported main model format for Wan: (.+?)\\. Use a Diffusers folder, a GGUF file, or a single-file safetensors checkpoint\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/wan_model_loader.py","lineNumber":258,"sourceCode":"                        message += (\n                            \" Its filename tags it as the low-noise expert; when running a single expert, \"\n                            \"the high-noise one is usually the better choice.\"\n                        )\n                    context.logger.warning(message)\n\n            # Borrow the boundary_ratio recorded on the optional Diffusers\n            # component_source, when one is wired.\n            if self.component_source is not None:\n                src_cfg = context.models.get_config(self.component_source)\n                src_boundary = getattr(src_cfg, \"boundary_ratio\", None)\n                if (\n                    src_cfg.format == ModelFormat.Diffusers\n                    and getattr(src_cfg, \"variant\", None) == main_variant\n                    and src_boundary is not None\n                ):\n                    boundary_ratio = float(src_boundary)\n        else:\n            raise ValueError(\n                f\"Unsupported main model format for Wan: {main_format.value}. \"\n                \"Use a Diffusers folder, a GGUF file, or a single-file safetensors checkpoint.\"\n            )\n\n        # VAE: standalone override > main (if Diffusers) > component source.\n        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            )","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/wan_model_loader.py#L240-L276","documentation":"WanModelLoaderInvocation.invoke only supports three main-model formats for Wan: Diffusers folders, GGUF files, and single-file safetensors checkpoints. If the resolved main model config has any other format value, it throws ValueError in the format-dispatch chain. This is a guard against loading model artifacts the loader cannot interpret.","triggerScenarios":"Calling invoke() on a WanModelLoaderInvocation whose 'model' field resolves to a Wan Main model whose config format is not Diffusers, GGUF, or Checkpoint (single-file safetensors) — e.g. a format value like Onnx, or any format added later.","commonSituations":"A model was installed/registered with the wrong format metadata; a user pointed the invocation at a model imported via a different pipeline (e.g. ONNX or an unsupported single-file layout); a database scan imported a legacy format for Wan that this loader doesn't branch on.","solutions":["Re-register the model as a Diffusers folder (recommended) and select it in the invocation","Use a GGUF quantized Wan transformer file or a single-file safetensors checkpoint instead","Check the model's format in the Model Manager UI and re-import/convert it if it shows an unsupported format like ONNX"],"exampleFix":"// before: invocation points at a model whose config.format is unsupported\nmodel=ModelIdentifierField(key='wan-main-onnx', submodel_type=SubModelType.Transformer)\n// after: point at a Diffusers-format Wan main model\nmodel=ModelIdentifierField(key='wan-main-diffusers', submodel_type=SubModelType.Transformer)","handlingStrategy":"validation","validationCode":"cfg = context.models.get_config(invocation.model)\nallowed = {'diffusers', 'gguf', 'checkpoint'}\nif cfg.format.value.lower() not in allowed:\n    raise ValueError(f\"Wan main model must be Diffusers/GGUF/safetensors, got {cfg.format.value}\")","typeGuard":"def is_supported_wan_main_format(cfg) -> bool:\n    return getattr(cfg, 'base', None) == BaseModelType.Wan and cfg.format in {\n        ModelFormat.Diffusers, ModelFormat.GGUF, ModelFormat.Checkpoint\n    }","tryCatchPattern":"try:\n    output = invocation.invoke(context)\nexcept ValueError as e:\n    if 'Unsupported main model format for Wan' in str(e):\n        # re-select a Diffusers/GGUF/safetensors model before retrying\n        ...","preventionTips":["Import Wan models as Diffusers folders whenever possible","Check the format badge in the Model Manager before wiring a model into a Wan loader","Keep GGUF and safetensors Wan files out of the main-model slot unless intentionally using those loaders"],"tags":["model-loader","unsupported-format","wan","validation"],"backgroundTag":"unsupported-model-format","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}