{"record":{"id":"2f3a3db968339cc2","repo":"invoke-ai/InvokeAI","slug":"expected-autoencoderklwan-or-fluxautoencoder-for-a-2f3a3d","errorCode":null,"errorMessage":"Expected AutoencoderKLWan or FluxAutoEncoder for Anima VAE, got {type(vae_info.model).__name__}.","messagePattern":"Expected AutoencoderKLWan or FluxAutoEncoder for Anima VAE, got (.+?)\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/anima_latents_to_image.py","lineNumber":115,"sourceCode":"        ~1s tiled with the transformer left resident). Tile when the full-decode working\n        memory would consume most of the device, otherwise a single-pass decode is\n        faster (~0.65s vs ~1.05s at 1024x1024) and exact.\n        \"\"\"\n        if device.type == \"cuda\":\n            total_vram = torch.cuda.get_device_properties(device).total_memory\n        elif device.type == \"xpu\":\n            total_vram = torch.xpu.get_device_properties(device).total_memory\n        else:\n            return False\n        return full_decode_working_memory > 0.7 * total_vram\n\n    @torch.no_grad()\n    def invoke(self, context: InvocationContext) -> ImageOutput:\n        latents = context.tensors.load(self.latents.latents_name)\n\n        vae_info = context.models.load(self.vae.vae)\n        if not isinstance(vae_info.model, (AutoencoderKLWan, FluxAutoEncoder)):\n            raise TypeError(\n                f\"Expected AutoencoderKLWan or FluxAutoEncoder for Anima VAE, got {type(vae_info.model).__name__}.\"\n            )\n\n        use_tiling = False\n        if isinstance(vae_info.model, AutoencoderKLWan):\n            full_decode_working_memory = estimate_vae_working_memory_anima(\n                operation=\"decode\",\n                image_tensor=latents,\n                vae=vae_info.model,\n                tile_size=None,\n            )\n            use_tiling = self._use_tiled_decode(TorchDevice.choose_torch_device(), full_decode_working_memory)\n            estimated_working_memory = estimate_vae_working_memory_anima(\n                operation=\"decode\",\n                image_tensor=latents,\n                vae=vae_info.model,\n                tile_size=ANIMA_VAE_TILE_SIZE if use_tiling else None,\n            )","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/anima_latents_to_image.py#L97-L133","documentation":"In the Anima latents-to-image invocation, the loaded VAE must be an AutoencoderKLWan or FluxAutoEncoder for decoding; this TypeError is raised immediately after context.models.load if the model is any other class.","triggerScenarios":"Decoding Anima latents with a vae input whose loaded model is not an Anima-compatible VAE (e.g. an SD/SDXL AutoencoderKL).","commonSituations":"Selecting the default pipeline VAE for the wrong model family; workflow templates carried over from SDXL; duplicate model keys causing the manager to load the wrong record.","solutions":["Use an Anima-compatible VAE (AutoencoderKLWan or FluxAutoEncoder) in the LatentsToImage node.","Verify the VAE record's base model/architecture in the model manager.","Re-scan models or re-import the VAE so it registers under the correct class."],"exampleFix":"// before\nlatents2img.vae = vae_loader(\"sd-vae-1.4\")\n// after\nlatents2img.vae = vae_loader(\"anima-vae\")","handlingStrategy":"type-guard","validationCode":"vae_info = context.models.load(vae_field.vae)\nif not is_anima_vae(vae_info.model):\n    raise ValueError(\"Anima latents-to-image requires AutoencoderKLWan/FluxAutoEncoder\")","typeGuard":"def is_anima_vae(model) -> bool:\n    from diffusers import AutoencoderKLWan\n    from invokeai.backend.flux.model import FluxAutoEncoder\n    return isinstance(model, (AutoencoderKLWan, FluxAutoEncoder))","tryCatchPattern":"try:\n    output = node.invoke(context)\nexcept TypeError as e:\n    if \"Anima VAE\" in str(e):\n        raise RuntimeError(\"Attach the matching Anima VAE for decode\") from e","preventionTips":["Pair latents and VAE from the same model family","Check model base/architecture fields in the manager","Re-import VAEs registered under the wrong class"],"tags":["vae","type-error","decode"],"backgroundTag":"incompatible-model-type","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}