Nodes/ymc-node-as-x-type/set it as vae type
ComfyUI Node

set it as vae type

When your decoded image never seems to arrive

By YMC-GitHub·Created 2 years ago·Updated about a year ago· 0
set it as vae type
  • a
  • vae

The VAE is the quiet member of the checkpoint family - a CLIP and a MODEL get all the attention, and the VAE just sits there decoding latents into pixels at the end. "Set it as vae type" is the niche of a niche: it only earns its place in workflows where the VAE itself has been dragged through an any-typed wire and the editor no longer recognizes it.

That's the recurring story of this whole pack, and it's worth stating once: ComfyUI keeps its type system honest, and any-typed junctions - Use Everywhere nodes, switches, API-fed inputs - erase type information. A VAE that traveled through such a junction arrives looking like *, and a strict VAE input (the VAE Decode node is the classic) may refuse the wire or accept it and only fail at execution. This node takes whatever is on a, returns it unchanged, and stamps the output as VAE. Wire its output into the vae socket of a VAE Decode or VAE Encode and you're back in type-safe territory.

The source is the same two-liner as every sibling: exec(self, a=None): return (a,), with RETURN_TYPES = ("VAE",) doing the only real work. Nothing is loaded, swapped, or validated. You're telling the graph "this is a VAE," and the graph takes your word.

When you'd reach for it

  • You've got one VAE routed to several decode branches through an any-node and a typed socket is being stubborn.
  • You're swapping VAEs (say, switching to a dedicated high-quality VAE) via a switch node and want the decoder to accept the result.
  • Any cg-use-everywhere style graph where the README's stated goal - "enhance use cg-use-everywhere to link nodes" - applies.

If your workflow is plain linear generation, skip it. VAE sockets find each other on their own.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/YMC-GitHub/ymc-node-as-x-type

or via ComfyUI Manager (search ymc-node-as-x-type), restart. No models to download; the four yors_* pip deps auto-install on startup. Find it by double-clicking and typing set it as, or right-click → YMC → LINK.

Gotchas

  • A label, not a loader. If the wire doesn't actually hold a VAE object, the decode step will fail - the error just shows up elsewhere.
  • One-commit, single-maintainer pack (v0.1.2). Low maintenance, low expectations.
CategoryYMC/LINK

Inputs (1)

NameTypeDefaultDescription
aopt*

Outputs (1)

NameTypeDescription
vaeVAE