{"record":{"id":"f409cf5aafe311a5","repo":"Comfy-Org/ComfyUI","slug":"this-uni3c-controlnet-expects-a-wan-model-with-dim","errorCode":null,"errorMessage":"This Uni3C ControlNet expects a Wan model with dim {}, the loaded model has dim {}.","messagePattern":"This Uni3C ControlNet expects a Wan model with dim (.+?), the loaded model has dim (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_extras/nodes_model_patch.py","lineNumber":733,"sourceCode":"                              \"strength\": (\"FLOAT\", {\"default\": 1.0, \"min\": -10.0, \"max\": 10.0, \"step\": 0.01}),\n                              \"start_percent\": (\"FLOAT\", {\"default\": 0.0, \"min\": 0.0, \"max\": 1.0, \"step\": 0.001}),\n                              \"end_percent\": (\"FLOAT\", {\"default\": 1.0, \"min\": 0.0, \"max\": 1.0, \"step\": 0.001}),\n                              }}\n    RETURN_TYPES = (\"MODEL\",)\n    FUNCTION = \"apply_patch\"\n    EXPERIMENTAL = True\n\n    CATEGORY = \"model/patch/wan\"\n\n    def apply_patch(self, model, model_patch, vae, render_video, strength, start_percent, end_percent):\n        if not isinstance(model_patch.model, comfy.ldm.wan.uni3c.WanUni3CControlnet):\n            raise ValueError(\"The connected model patch is not a Uni3C ControlNet.\")\n        cnet_dim = model_patch.model.controlnet_blocks[0].norm1.linear.in_features\n        model_dim = getattr(model.get_model_object(\"diffusion_model\"), \"dim\", None)\n        if model_dim is None:\n            raise ValueError(\"The Uni3C ControlNet only works with Wan models.\")\n        if model_dim != cnet_dim:\n            raise ValueError(\"This Uni3C ControlNet expects a Wan model with dim {}, the loaded model has dim {}.\".format(cnet_dim, model_dim))\n\n        model_patched = model.clone()\n        model_sampling = model.get_model_object(\"model_sampling\")\n        sigma_start = model_sampling.percent_to_sigma(start_percent)\n        sigma_end = model_sampling.percent_to_sigma(end_percent)\n        latent_format = model.get_model_object(\"latent_format\")\n        patch = WanUni3CCnetPatch(model_patch, render_video[:, :, :, :3], vae, latent_format, strength, sigma_start, sigma_end)\n        model_patched.set_model_double_block_patch(patch)\n        return (model_patched,)\n\n\nclass UsoStyleProjectorPatch:\n    def __init__(self, model_patch, encoded_image):\n        self.model_patch = model_patch\n        self.encoded_image = encoded_image\n\n    def __call__(self, kwargs):\n        txt_ids = kwargs.get(\"txt_ids\")","sourceCodeStart":715,"sourceCodeEnd":751,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_extras/nodes_model_patch.py#L715-L751","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"cnet_dim = model_patch.model.controlnet_blocks[0].norm1.linear.in_features\nmodel_dim = model.get_model_object('diffusion_model').dim\nif model_dim != cnet_dim:\n    raise UserFacingError(f'dim mismatch: controlnet {cnet_dim} vs model {model_dim}')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["uni3c","dim-mismatch","model-compat","controlnet"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}