Recast VAE
A typed pass-through for your decoder
- vae
- VAE
Recast VAE takes a VAE in and returns the same VAE, unchanged. It's the last and least glamorous member of the Typecaster family, and if you've never felt the need for it, congratulations - you haven't hit the bug it exists for yet.
The bug, in short: ComfyUI wires nodes by declared type, and some custom nodes get away with declaring "anything" as an input. That works at runtime, but it plays havoc with workflow loading - a node that accepts anything can't always tell what type is flowing until it actually executes, so the first time a workflow opens in the browser, the connection can be left unresolved, or the node fails to initialize. Queue once, let it fail, and things may sort themselves out - but nobody wants a failed run as a setup step.
The VAE is the encoder/decoder pair that shuttles data between pixels and the latent space the sampler works in. Its wire normally runs from your checkpoint loader (or a dedicated VAE loader) to a VAE encode or decode node - a boring, dependable connection. It stops being dependable when one end is a wildcard output from another pack, especially model-bundle helpers that can hand out a model, CLIP, and VAE individually or as an "anything." Recast VAE is the typed island you drop on that wire: the dynamic output feeds its VAE input, and its VAE output is concretely typed from the moment the graph loads.
The author's README frames the entire family as a code cast - emptyLatent = (Latent)emptyLatent; - declaring the type without touching the value. onRun here is just return (vae,). There's no decoding, no re-encoding, no copying; the node is a no-op that happens to have a type.
The whole interface
One input, one output, nothing else. No widgets, no settings, no state.
- vae (VAE) - in.
- VAE - out.
Installing it
It's part of the ComfyKit Custom Nodes pack (bobmagicii/comfykit-custom-nodes). Easiest via ComfyUI Manager - search "ComfyKit Custom Nodes". Or clone:
cd ComfyUI/custom_nodes
git clone https://github.com/bobmagicii/comfykit-custom-nodes
Restart ComfyUI. No requirements.txt, no model files to download - the whole pack is plain Python over core ComfyUI modules.
The caveat, in one line
A cast fixes the label, not the substance: if the "anything" is secretly not a VAE, Recast VAE will happily hand the wrong object to your decoder wearing a VAE badge, and the real failure just moves downstream. Check what the upstream node actually produces, confirm the destination wants VAE, and you've added the most harmless node in ComfyUI to your graph - one that is physically incapable of changing your data.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| vae | VAE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| VAE | VAE | — |