ComfyUI Node

Motorway 2x2

Motorway 2x2

By agilly1989Β·Created 2 years agoΒ·Updated about a year agoΒ· 7
Motorway 2x2
  • MOTORWAY πŸšŒπŸ’¨
  • ANY_(A)
  • ANY_(B)
  • MOTORWAY πŸšŒπŸ’¨
  • ANY (A)
  • ANY (B)
β—„ANY_(A)_keyβ€”β–Ί
β—„ANY_(B)_keyβ€”β–Ί

Motorway 2x2 is the workhorse of the agilly1989 Motorway pack - the symmetric junction you'll reach for first, because it's the shape that covers most real plumbing: two values in, the same two values out, and the bus carries on. The name follows the pack's Motorway [inputs]x[outputs] convention, so 2x2 is two in, two out. It's the default "on-ramp and off-ramp" node: park two things on the bus, and get two of them back immediately.

The Motorway is a beta "pipe" implementation by solo dev agilly1989, built in the same spirit as rgthree's Context nodes or Impact Pack pipes: instead of dragging a dozen wires across your canvas, you bundle values onto one wire. The difference from the other pipe packs is the transport. Every node here passes around a MotorwayClass bus object - its MOTORWAY πŸšŒπŸ’¨ connection, which is both the required input and the always-present output. It's called a motorway because you start with MotorwayStart and drive values down the route.

How it works

Wire two values into ANY_(A) and ANY_(B). Then the naming step, which is where people get tripped up: each input has a matching _key box - ANY_(A)_key and ANY_(B)_key - and you type a name into each. Whatever string you type is stored as a key, and the pack hashes it with sha256 under the hood (your key positive becomes an attribute like hash_4f1a…, which is why errors look like 'MotorwayClass' object has no attribute 'hash_'). Type the same key on any later node and you get the value back.

Because inputs equal outputs here, the key slots line up 1:1 and each does double duty:

  • inputs ANY_(A) / ANY_(B) with keys ANY_(A)_key / ANY_(B)_key
  • the required MOTORWAY πŸšŒπŸ’¨ bus input
  • outputs MOTORWAY πŸšŒπŸ’¨, ANY (A), ANY (B)

Slot A's key names input A and reads output A, so a 2x2 is simultaneously "store these two" and "read these two." If you want to write one key and read a different one, this isn't the node - a 2x0 writes without reading, and a 1x2 or 2x3 gives you spare output slots for pure reads. Reusing a key anywhere on the route overwrites the old value, which is how you update state as the bus flows.

Installing

cd ComfyUI/custom_nodes
git clone https://github.com/agilly1989/ComfyUI_agilly1989_motorway

then restart ComfyUI. Or grab it from ComfyUI Manager under ComfyUI_agilly1989_motorway. No pip dependencies, no model files - it's pure Python, so install is just clone-and-restart. The repo's Example.json is worth loading to see the pattern in a real graph.

Common issues

  • hash_ attribute error: the key you referenced was never written, or was written with a slightly different string. Keys match exactly, spaces and case count.
  • Empty key slots are the number-one footgun: an empty _key means that output never gets produced, and the moment you wire anything into it ComfyUI errors on a missing output. Fill every key.
  • Don't fill a key on a disconnected input. It stores None under that name and clobbers whatever was there.

Beta pack, occasional breakage, zero sympathy from the author - but for the everyday "take two, give back two" junction, 2x2 is the one you'll keep in your muscle memory.

Categoryagilly1989 Nodes/Motorways

Inputs (5)

NameTypeDefaultDescription
MOTORWAY πŸšŒπŸ’¨MOTORWAY πŸšŒπŸ’¨β€”
ANY_(A)opt*β€”
ANY_(B)opt*β€”
ANY_(A)_keyoptSTRINGβ€”
ANY_(B)_keyoptSTRINGβ€”

Outputs (3)

NameTypeDescription
MOTORWAY πŸšŒπŸ’¨MOTORWAY πŸšŒπŸ’¨β€”
ANY (A)*β€”
ANY (B)*β€”