Comfy-Org/ComfyUI · error · ValueError
The Uni3C ControlNet only works with Wan models.
Error message
The Uni3C ControlNet only works with Wan models.
What it means
After confirming a Uni3C ControlNet, the node reads the diffusion model's dim attribute to match dimensions. Wan DiT models expose dim; models without a dim attribute (getattr returns None) are by definition not Wan-family, so the node refuses to patch them.
Source
Thrown at comfy_extras/nodes_model_patch.py:731
"vae": ("VAE",),
"render_video": ("IMAGE", {"tooltip": "The guidance video rendered from the camera trajectory, most commonly warped point cloud renders of the input image."}),
"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
View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Use a Wan-family video model as the model input (e.g. Wan 2.1/2.2 DiT checkpoints loaded through the Wan loader).
- If using a custom Wan-derived architecture, expose a dim attribute on diffusion_model or patch via a custom node.
- Double-check the checkpoint loader pointed at a Wan model file.
Defensive patterns
Strategy: type-guard
Validate before calling
model_dim = getattr(model.get_model_object('diffusion_model'), 'dim', None)
if model_dim is None:
raise UserFacingError('Uni3C requires a Wan-family model') Type guard
def is_wan_model(model) -> bool:
return getattr(model.get_model_object('diffusion_model'), 'dim', None) is not None Prevention
- Pair Uni3C only with Wan 2.x checkpoints.
- Confirm the checkpoint loader targets a Wan model file.
- Custom Wan derivatives must expose a dim attribute.
When it happens
Trigger: Connecting a non-Wan diffusion model (Flux, SD3, Hunyuan, etc.) to the model input; the check is 'getattr(diffusion_model, "dim", None) is None'.
Common situations: Reusing a Flux/SD workflow and swapping only the controlnet branch; loading a Wan-adjacent custom model that does not expose the standard dim attribute.
Related errors
- The connected model patch is not a Uni3C ControlNet.
- y is None, did you try using a controlnet for SDXL on SD1?
- The number of controls is not equal to the number of skip co
- This Uni3C ControlNet expects a Wan model with dim {}, the l
- Control type {max_type_name}({max_type}) is out of range for
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/6a63e678af0086d6.
Report an issue: GitHub.