invoke-ai/InvokeAI · warning · NotAMatchError

model is a Wan-family VAE, not a standard VAE

Error message

model is a Wan-family VAE, not a standard VAE

What it means

InvokeAI's VAE model probe (_validate_looks_like_vae) checks a candidate VAE's state_dict to make sure it is a standard AutoencoderKL. When the weights match a FLUX.2 VAE, a Qwen Image VAE, or any Wan-family VAE (AutoencoderKLWan architecture, detected via _wan_vae_z_dim), the probe raises NotAMatchError because each of those architectures has its own dedicated config class and must not be registered as a generic VAE.

Source

Thrown at invokeai/backend/model_manager/configs/vae.py:153

    def _validate_looks_like_vae(cls, mod: ModelOnDisk) -> None:
        state_dict = mod.load_state_dict()
        if not state_dict_has_any_keys_starting_with(
            state_dict,
            {
                "encoder.conv_in",
                "decoder.conv_in",
            },
        ):
            raise NotAMatchError("model does not match Checkpoint VAE heuristics")

        # Exclude FLUX.2 VAEs - they have their own config class
        if _is_flux2_vae(state_dict):
            raise NotAMatchError("model is a FLUX.2 VAE, not a standard VAE")

        # Exclude Qwen Image / Wan VAEs - they share the AutoencoderKLWan
        # architecture and each has its own config class.
        if _is_qwen_image_vae(state_dict) or _wan_vae_z_dim(state_dict) is not None:
            raise NotAMatchError("model is a Wan-family VAE, not a standard VAE")

    @classmethod
    def _get_base_or_raise(cls, mod: ModelOnDisk) -> BaseModelType:
        # First, try to identify by latent space dimensions (most reliable)
        state_dict = mod.load_state_dict()
        decoder_conv_in_key = "decoder.conv_in.weight"
        if decoder_conv_in_key in state_dict:
            latent_channels = state_dict[decoder_conv_in_key].shape[1]
            if latent_channels == 16:
                # Flux1 VAE has 16-dimensional latent space
                return BaseModelType.Flux
            elif latent_channels == 4:
                # SD/SDXL VAE has 4-dimensional latent space
                # Try to distinguish SD1/SD2/SDXL by name, fallback to SD1
                for regexp, base in REGEX_TO_BASE.items():
                    if re.search(regexp, mod.path.name, re.IGNORECASE):
                        return base
                # Default to SD1 if we can't determine from name

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Let InvokeAI scan the model normally; it will be registered under the correct Qwen/Wan config class, not as a standard VAE.
  2. Verify the file really is a VAE and not mislabeled; if you intended a standard SD VAE, re-download from the correct source.
  3. If support for this VAE is missing in your InvokeAI version, upgrade to a version that registers the specific Wan/Qwen VAE config class.

Example fix

// before: forcing a Wan VAE through the generic VAE probe
config = VAE.from_model_on_disk(wan_vae_dir, base=BaseModelType.Any)
// after: let the installer pick the right config family, or check first
from invokeai.backend.model_manager.configs.vae import _wan_vae_z_dim
if _wan_vae_z_disk_dict(wan_vae_dir) is not None:
    raise ValueError("Wan-family VAE; use the Wan model installer instead of the generic VAE importer")
Defensive patterns

Strategy: validation

Validate before calling

from invokeai.backend.model_manager.configs.vae import _wan_vae_z_dim, _is_qwen_image_vae
sd = model_on_disk.load_state_dict()
if _is_qwen_image_vae(sd) or _wan_vae_z_dim(sd) is not None:
    print("Wan/Qwen-family VAE: use its dedicated config class, not the generic VAE importer")

Type guard

def is_standard_vae(state_dict) -> bool:
    return not (_is_flux2_vae(state_dict) or _is_qwen_image_vae(state_dict) or _wan_vae_z_dim(state_dict) is not None)

Try / catch

from invokeai.backend.model_manager.configs.base import NotAMatchError
try:
    config = VAE.from_model_on_disk(model_path, base=BaseModelType.Any)
except NotAMatchError:
    config = scan_model(model_path)  # fall back to generic identification

Prevention

When it happens

Trigger: Calling VAE.from_model_on_disk (directly or via model import/scan) on a directory or checkpoint whose state_dict matches _is_qwen_image_vae or returns a non-None z-dim from _wan_vae_z_dim.

Common situations: User downloads a Wan 2.1/2.2 VAE or Qwen Image VAE and drops it into the VAE folder, expecting the generic VAE importer to accept it; bulk re-scanning a model library after adding new-community Wan-family checkpoints.

Related errors


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