invoke-ai/InvokeAI · error · ValueError

Unsupported main model format for Wan: {main_format.value}.

Error message

Unsupported main model format for Wan: {main_format.value}. Use a Diffusers folder, a GGUF file, or a single-file safetensors checkpoint.

What it means

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.

Source

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

                        message += (
                            " Its filename tags it as the low-noise expert; when running a single expert, "
                            "the high-noise one is usually the better choice."
                        )
                    context.logger.warning(message)

            # Borrow the boundary_ratio recorded on the optional Diffusers
            # component_source, when one is wired.
            if self.component_source is not None:
                src_cfg = context.models.get_config(self.component_source)
                src_boundary = getattr(src_cfg, "boundary_ratio", None)
                if (
                    src_cfg.format == ModelFormat.Diffusers
                    and getattr(src_cfg, "variant", None) == main_variant
                    and src_boundary is not None
                ):
                    boundary_ratio = float(src_boundary)
        else:
            raise ValueError(
                f"Unsupported main model format for Wan: {main_format.value}. "
                "Use a Diffusers folder, a GGUF file, or a single-file safetensors checkpoint."
            )

        # VAE: standalone override > main (if Diffusers) > component source.
        if self.vae_model is not None:
            self._validate_standalone_vae(context, self.vae_model, main_variant)
            vae = self.vae_model.model_copy(update={"submodel_type": SubModelType.VAE})
        elif main_is_diffusers:
            vae = self.model.model_copy(update={"submodel_type": SubModelType.VAE})
        elif self.component_source is not None:
            self._validate_component_source_vae(context, self.component_source, main_variant)
            vae = self.component_source.model_copy(update={"submodel_type": SubModelType.VAE})
        else:
            raise ValueError(
                "No source for VAE. Either set 'VAE' to a standalone Wan VAE, "
                "or set 'Component Source' to a Diffusers Wan main model."
            )

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Re-register the model as a Diffusers folder (recommended) and select it in the invocation
  2. Use a GGUF quantized Wan transformer file or a single-file safetensors checkpoint instead
  3. Check the model's format in the Model Manager UI and re-import/convert it if it shows an unsupported format like ONNX

Example fix

// before: invocation points at a model whose config.format is unsupported
model=ModelIdentifierField(key='wan-main-onnx', submodel_type=SubModelType.Transformer)
// after: point at a Diffusers-format Wan main model
model=ModelIdentifierField(key='wan-main-diffusers', submodel_type=SubModelType.Transformer)
Defensive patterns

Strategy: validation

Validate before calling

cfg = context.models.get_config(invocation.model)
allowed = {'diffusers', 'gguf', 'checkpoint'}
if cfg.format.value.lower() not in allowed:
    raise ValueError(f"Wan main model must be Diffusers/GGUF/safetensors, got {cfg.format.value}")

Type guard

def is_supported_wan_main_format(cfg) -> bool:
    return getattr(cfg, 'base', None) == BaseModelType.Wan and cfg.format in {
        ModelFormat.Diffusers, ModelFormat.GGUF, ModelFormat.Checkpoint
    }

Try / catch

try:
    output = invocation.invoke(context)
except ValueError as e:
    if 'Unsupported main model format for Wan' in str(e):
        # re-select a Diffusers/GGUF/safetensors model before retrying
        ...

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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