Comfy-Org/ComfyUI · error · ValueError
This Uni3C ControlNet expects a Wan model with dim {}, the l
Error message
This Uni3C ControlNet expects a Wan model with dim {}, the loaded model has dim {}. What it means
The Uni3C ControlNet's block width (controlnet_blocks[0].norm1.linear.in_features) must equal the target model's dim. A dimensional mismatch means the controlnet was trained for a different Wan variant (e.g. 14B vs 1.3B), and patching would fail or corrupt attention math, so the node reports both dims.
Source
Thrown at comfy_extras/nodes_model_patch.py:733
"strength": ("FLOAT", {"default": 1.0, "min": -10.0, "max": 10.0, "step": 0.01}),
"start_percent": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 1.0, "step": 0.001}),
"end_percent": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.001}),
}}
RETURN_TYPES = ("MODEL",)
FUNCTION = "apply_patch"
EXPERIMENTAL = True
CATEGORY = "model/patch/wan"
def apply_patch(self, model, model_patch, vae, render_video, strength, start_percent, end_percent):
if not isinstance(model_patch.model, comfy.ldm.wan.uni3c.WanUni3CControlnet):
raise ValueError("The connected model patch is not a Uni3C ControlNet.")
cnet_dim = model_patch.model.controlnet_blocks[0].norm1.linear.in_features
model_dim = getattr(model.get_model_object("diffusion_model"), "dim", None)
if model_dim is None:
raise ValueError("The Uni3C ControlNet only works with Wan models.")
if model_dim != cnet_dim:
raise ValueError("This Uni3C ControlNet expects a Wan model with dim {}, the loaded model has dim {}.".format(cnet_dim, model_dim))
model_patched = model.clone()
model_sampling = model.get_model_object("model_sampling")
sigma_start = model_sampling.percent_to_sigma(start_percent)
sigma_end = model_sampling.percent_to_sigma(end_percent)
latent_format = model.get_model_object("latent_format")
patch = WanUni3CCnetPatch(model_patch, render_video[:, :, :, :3], vae, latent_format, strength, sigma_start, sigma_end)
model_patched.set_model_double_block_patch(patch)
return (model_patched,)
class UsoStyleProjectorPatch:
def __init__(self, model_patch, encoded_image):
self.model_patch = model_patch
self.encoded_image = encoded_image
def __call__(self, kwargs):
txt_ids = kwargs.get("txt_ids")View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Download the Uni3C ControlNet variant that matches your Wan model's dim (the error message states both expected and actual).
- Switch the base model to the variant the controlnet was trained on.
- Confirm dims in Python: model.get_model_object('diffusion_model').dim vs controlnet_blocks[0].norm1.linear.in_features.
Defensive patterns
Strategy: validation
Validate before calling
cnet_dim = model_patch.model.controlnet_blocks[0].norm1.linear.in_features
model_dim = model.get_model_object('diffusion_model').dim
if model_dim != cnet_dim:
raise UserFacingError(f'dim mismatch: controlnet {cnet_dim} vs model {model_dim}') Prevention
- Download the Uni3C variant matching your Wan model size (1.3B vs 14B).
- Record expected dims alongside controlnet files.
- Read the error message: it states both expected and actual dim.
When it happens
Trigger: Pairing a Uni3C controlnet trained on Wan 1.3B (dim 1536) with a 14B model (dim 5120) or vice versa; any combination where cnet_dim != model_dim.
Common situations: Downloading the controlnet matching the wrong base model size; mixing T2V and I2V variants of different scales; upgrading the base model without re-fetching the controlnet.
Related errors
- The connected model patch is not a Uni3C ControlNet.
- The Uni3C ControlNet only works with Wan models.
- Control type {max_type_name}({max_type}) is out of range for
- y is None, did you try using a controlnet for SDXL on SD1?
- This Controlnet needs a VAE but none was provided, please us
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/f409cf5aafe311a5.
Report an issue: GitHub.