ComfyUI Node

Context

One wire instead of forty, and the stale-bundle trap that comes with it

By lany42·Created 22 days ago·Updated about 22 hours ago· 1
Context
  • base_ctx
  • model
  • clip
  • vae
  • positive
  • negative
  • latent
  • images
  • controlnet
  • upscale_model
  • tile_plan
  • api_client
  • any_1
  • any_2
  • any_3
  • any_4
  • CONTEXT
  • MODEL
  • CLIP
  • VAE
  • POSITIVE
  • NEGATIVE
  • LATENT
  • IMAGES
  • SEED
  • WIDTH
  • HEIGHT
  • SCALE
  • PROMPT_POS
  • PROMPT_NEG
  • MODEL_NAMES
  • CONTROLNET
  • UPSCALE_MODEL
  • TILE_PLAN
  • API_CLIENT
  • ANY_1
  • ANY_2
  • ANY_3
  • ANY_4
◄seed—►
◄width—►
◄height—►
◄scale—►
◄prompt_pos—►
◄prompt_neg—►
◄model_names—►

If you've ever dragged a model, a clip, a vae, two conditionings, a latent, a width, a height and a seed across twenty nodes, you already know why this node exists. Context takes all of that and puts it on one wire. That's the whole pitch, and it's not a new idea - rgthree's Context Big and Easy-Use's pipes have been doing it for years. This is the Lany Nodes version, written fresh against ComfyUI's V3 node API.

What it actually does

Context is a merge node, nothing more clever than that. You connect what you have, leave the rest empty, and it hands back a bundle plus every field as its own output. The description is refreshingly blunt about the rules: omitted inputs are inherited from base_ctx, connected values override inherited entries and must not be None, and unset outputs return None.

base_ctx is the part that makes it a bus rather than a hub. Chain a second Context off the first one's CONTEXT output, connect only the thing that changed (say, a new vae after a LoRA merge, or the latent your sampler just produced), and you've extended the bundle down one wire. The node copies the incoming dictionary before merging, so overrides can't mutate the upstream context - and everything travels by reference, so you're not copying tensors around.

The inputs and outputs that matter

Everything is optional. base_ctx (type LANY_CONTEXT) carries the inherited bundle; then model, clip, vae, positive, negative, latent, images, seed, width, height, prompt_pos, prompt_neg, model_names, controlnet, upscale_model, and four wildcard slots any_1 through any_4 for whatever else you want to carry.

One thing that catches people out: seed, width, height, prompt_pos, prompt_neg and model_names are socket-only. There's no widget to type a prompt into - you wire it in from wherever it lives. That's deliberate (the point is one source of truth) but it means Context is useless as a text-holding node.

The outputs mirror the inputs, in the same order, in caps: CONTEXT, then MODEL, CLIP, VAE, POSITIVE, NEGATIVE, LATENT, IMAGES, SEED, WIDTH, HEIGHT, PROMPT_POS, PROMPT_NEG, MODEL_NAMES, CONTROLNET, UPSCALE_MODEL, ANY_1–ANY_4. Each is properly typed, so MODEL plugs into anything that wants a model. In practice you wire CONTEXT forward and pull a field or two off the tail of the chain.

When to reach for it

Large, mostly-static graphs. Loader → Context → sampler end → Context → decode is the classic shape, and it turns a screen of noodles into three nodes and one line. If your workflow fits on one screen, skip it - a context bus in a small graph adds a layer of indirection and buys you nothing.

The failure mode is the interesting part, and it's the same one every context implementation has. Because the bundle carries everything, it's easy to unpack a model that was assembled before the LoRA loader ran and silently sample the base weights. With forty explicit wires you can see that the LoRA output isn't connected to the sampler. With one bundle, the connection is there and the contents are wrong - and nothing errors, you just get a slightly off image. Context is a debugging tax you pay in exchange for legibility.

Also worth knowing: LANY_CONTEXT is this pack's own type. It does not interoperate with rgthree's context nodes or Easy-Use's pipes. Adopt one bus and you're married to that pack.

Install

cd /path/to/ComfyUI/custom_nodes
git clone https://github.com/lany42/comfyui-lany-nodes.git
# restart ComfyUI

Or search comfyui-lany-nodes in ComfyUI Manager (published as "ComfyUI Lany Nodes"). No models to download; the runtime deps are just numpy and Pillow. The one requirement that bites: it's built on ComfyUI's V3 node API and needs Python 3.13+, so on a stale ComfyUI the whole pack simply won't register - the nodes won't error, they just won't be in the Lany Nodes category.

If it misbehaves

If a Context does nothing, check whether base_ctx is wired into the right end of the chain - the common mistake is connecting the derived context into the upstream node's input and creating a loop that ComfyUI resolves by running whatever it can. If you get "Connected input 'x' must not be None", a node upstream returned an empty value for a field you wired in; unwire it and let inheritance handle it. And the recovery move for a wrong-mix image is always the same: the workflow is embedded in the PNG you saved, so drag it back in and inspect what's actually in the bundle.

CategoryLany Nodes

Inputs (23)

NameTypeDefaultDescription
base_ctxoptLANY_CONTEXT—
modeloptMODEL—
clipoptCLIP—
vaeoptVAE—
positiveoptCONDITIONING—
negativeoptCONDITIONING—
latentoptLATENT—
imagesoptIMAGE—
seedoptINT—
widthoptINT—
heightoptINT—
scaleoptFLOAT—
prompt_posoptSTRING—
prompt_negoptSTRING—
model_namesoptSTRING—
controlnetoptCONTROL_NET—
upscale_modeloptUPSCALE_MODEL—
tile_planopt*—
api_clientopt*—
any_1opt*—
any_2opt*—
any_3opt*—
any_4opt*—

Outputs (23)

NameTypeDescription
CONTEXTLANY_CONTEXT—
MODELMODEL—
CLIPCLIP—
VAEVAE—
POSITIVECONDITIONING—
NEGATIVECONDITIONING—
LATENTLATENT—
IMAGESIMAGE—
SEEDINT—
WIDTHINT—
HEIGHTINT—
SCALEFLOAT—
PROMPT_POSSTRING—
PROMPT_NEGSTRING—
MODEL_NAMESSTRING—
CONTROLNETCONTROL_NET—
UPSCALE_MODELUPSCALE_MODEL—
TILE_PLAN*—
API_CLIENT*—
ANY_1*—
ANY_2*—
ANY_3*—
ANY_4*—