{"record":{"id":"6a63e678af0086d6","repo":"Comfy-Org/ComfyUI","slug":"the-uni3c-controlnet-only-works-with-wan-models","errorCode":null,"errorMessage":"The Uni3C ControlNet only works with Wan models.","messagePattern":"The Uni3C ControlNet only works with Wan models\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_extras/nodes_model_patch.py","lineNumber":731,"sourceCode":"                              \"vae\": (\"VAE\",),\n                              \"render_video\": (\"IMAGE\", {\"tooltip\": \"The guidance video rendered from the camera trajectory, most commonly warped point cloud renders of the input image.\"}),\n                              \"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","sourceCodeStart":713,"sourceCodeEnd":749,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_extras/nodes_model_patch.py#L713-L749","documentation":"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.","triggerScenarios":"Connecting a non-Wan diffusion model (Flux, SD3, Hunyuan, etc.) to the model input; the check is 'getattr(diffusion_model, \"dim\", None) is None'.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"model_dim = getattr(model.get_model_object('diffusion_model'), 'dim', None)\nif model_dim is None:\n    raise UserFacingError('Uni3C requires a Wan-family model')","typeGuard":"def is_wan_model(model) -> bool:\n    return getattr(model.get_model_object('diffusion_model'), 'dim', None) is not None","tryCatchPattern":null,"preventionTips":["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."],"tags":["uni3c","wan","model-mismatch","controlnet"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}