Free | No tracking | Every fact with a source|German and English

Error / Models and files

mat1 and mat2 shapes cannot be multiplied (models don’t match)

In the workflow, models are combined that belong to different model families, for example an SDXL text encoder with an SD-1.5 model.

The message

RuntimeError: mat1 and mat2 shapes cannot be multiplied (154x2048 and 768x320)

Affects: ComfyUI

Why is this happening?

Checkpoint, text encoder (CLIP/T5), VAE, LoRA, and ControlNet must all match the same model family. If the wrong file or wrong type is selected in the “Load CLIP” or “DualCLIPLoader” node, the dimensions won’t match. Related messages are “expected input … to have 4 channels, but got 16 channels instead” (VAE doesn’t match) or “The size of tensor a … must match the size of tensor b”.

How to fix it

  1. Check all “Load CLIP” and “DualCLIPLoader” nodes connected to the sampler: the file and type must match the model. ComfyUI points this out itself.
  2. For Flux in DualCLIPLoader: put clip_l.safetensors in one slot and the T5 file in the other (e.g. t5xxl_fp8_e4m3fn.safetensors). Not the same file twice.
  3. For the message “4 channels … 16 channels”: the VAE doesn’t match. Flux and SD3 use 16 channels, SD 1.5 and SDXL use 4 channels. For Flux, you need ae.safetensors from the Flux package instead of an SDXL VAE.
  4. ControlNet and LoRA must match the base model: an SD-1.5 checkpoint needs an SD-1.5 ControlNet, SDXL needs an SDXL ControlNet.
  5. Safest option: start with an official template from the ComfyUI workflow templates and load all files from the same source.

Set up from scratch again

If it still doesn’t work after that, a fresh setup step by step often helps:

Terms for this

Similar errors

Sources

Checked on Oct 21, 2026. Didn't help? Ask in the forum and name the graphics card, program, and the full message.