π§ Debug Tensor Shape
Print the shape of any tensor to find a mismatch
- tensor
Half the cryptic red errors in ComfyUI come down to one thing: two tensors that were supposed to line up don't. A mask that's the wrong size for its image, a latent with a batch dimension you didn't expect, an image that's secretly got four channels instead of three. The error message tells you the shapes disagree but not which wire is the liar. DebugTensorShape is the flashlight - plug the suspicious wire into it, run, and it prints the tensor's dimensions so you can actually see what's flowing through.
It's a diagnostic node from ComfyUI Essentials by cubiq (Matteo Spinelli, the ComfyUI_IPAdapter_plus author), and it's the sort of thing you leave lying in a corner of a complicated graph the way you'd leave a print() in code you're debugging.
How it works
It's an output node, which in ComfyUI means it can be a graph endpoint that runs even with nothing wired after it - you don't need to route its result anywhere. It accepts a wildcard type (*), so it'll take an image, a latent, a mask, conditioning, more or less anything with a shape, and reports the dimensions. For an image you'll typically see something like [batch, height, width, channels]; for a latent the numbers are in the compressed latent space. Reading those four numbers is usually enough to spot the culprit instantly.
The inputs and outputs that matter
tensor(*, wildcard) - the one and only input. Because it's a wildcard, you can drop it onto any wire you're suspicious of without a type-conversion dance.- No outputs. It's a terminal node; the information comes out as printed shape info, not as a wire you connect onward.
How to install it
ComfyUI Manager: search ComfyUI Essentials, install, restart. Manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/cubiq/ComfyUI_essentials
pip install -r ComfyUI_essentials/requirements.txt
then restart. No downloads - it's a few lines of introspection.
Common issues & troubleshooting
I ran it but didn't see anything. The shape is reported through the node/console rather than as an image on your canvas. If you run a headless or hosted ComfyUI, look wherever that setup surfaces node output rather than expecting a picture to pop up in the graph.
It didn't fix my error. Right - it's not a fix, it's a probe. It tells you the shapes so you can add the resize, the reshape, or the channel-strip that reconciles them. Once you know the mismatch, nodes like ImageRemoveAlpha (drop a stray alpha channel) or a resize node usually resolve it.
It's a wildcard, so wire it anywhere. That's the point - don't overthink which output type you're inspecting. If a node two hops upstream is emitting something the wrong shape, tap that wire directly rather than guessing.
Missing after a Comfy update? Essentials is in maintenance-only mode as of April 2025, and pack nodes have broken against newer ComfyUI builds before. Update the pack through Manager; failing that, a Comfy rollback is the community's usual workaround.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| tensor | * | β |
Outputs (0)
No outputs