{"record":{"id":"0cc5e7cc46ef1bcc","repo":"Comfy-Org/ComfyUI","slug":"y-is-none-did-you-try-using-a-controlnet-for-sdxl","errorCode":null,"errorMessage":"y is None, did you try using a controlnet for SDXL on SD1?","messagePattern":"y is None, did you try using a controlnet for SDXL on SD1\\?","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy/cldm/cldm.py","lineNumber":417,"sourceCode":"                    \"Please consider using the ProMax ControlNet Union model.\\n\" +\n                    \"https://huggingface.co/xinsir/controlnet-union-sdxl-1.0/tree/main\"\n                )\n\n            emb += self.control_add_embedding(control_type, emb.dtype, emb.device)\n            if len(control_type) > 0:\n                if len(hint.shape) < 5:\n                    hint = hint.unsqueeze(dim=0)\n                guided_hint = self.union_controlnet_merge(hint, control_type, emb, context)\n\n        if guided_hint is None:\n            guided_hint = self.input_hint_block(hint, emb, context)\n\n        out_output = []\n        out_middle = []\n\n        if self.num_classes is not None:\n            if y is None:\n                raise ValueError(\"y is None, did you try using a controlnet for SDXL on SD1?\")\n            emb = emb + self.label_emb(y)\n\n        h = x\n        for module, zero_conv in zip(self.input_blocks, self.zero_convs):\n            if guided_hint is not None:\n                h = module(h, emb, context)\n                h += guided_hint\n                guided_hint = None\n            else:\n                h = module(h, emb, context)\n            out_output.append(zero_conv(h, emb, context))\n\n        h = self.middle_block(h, emb, context)\n        out_middle.append(self.middle_block_out(h, emb, context))\n\n        return {\"middle\": out_middle, \"output\": out_output}\n\n","sourceCodeStart":399,"sourceCodeEnd":435,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/cldm/cldm.py#L399-L435","documentation":"When a ControlNet was trained with class embeddings (num_classes is not None, typical for SDXL ControlNets that consume the 'y' conditioning vector), forward requires y at sampling time. SD1/SD2 pipelines do not produce this vector, so passing an SDXL controlnet against an SD1 checkpoint leaves y as None and raises ValueError immediately.","triggerScenarios":"Loading an SDXL ControlNet (e.g. sdxl-controlnet with label embedding) into a workflow whose UNet is SD1.x; mixing models where the controlnet expects adv_cond 'y' but the model sampler never supplies it.","commonSituations":"Wrong controlnet dropped into an SD1.5 workflow; using diffusers-style SDXL controlnets without wiring the extra conditioning; model folder mix-ups after a re-download.","solutions":["Match checkpoints: use the SDXL checkpoint with the SDXL controlnet, or swap in an SD1-compatible controlnet.","Check the controlnet's config/num_classes and the base model family before connecting nodes.","If the controlnet genuinely supports both, ensure your sampler/model patch path passes y (c_concat/adv conditioning) into forward."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if controlnet.num_classes is not None and y is None:\n    raise SystemExit(\"SDXL controlnet requires SDXL base model / y conditioning\")","typeGuard":"def controlnet_matches_base(controlnet, y) -> bool:\n    return controlnet.num_classes is None or y is not None","tryCatchPattern":"try:\n    controlnet(x_noisy, hint, timesteps, context, y=y)\nexcept ValueError as e:\n    if \"y is None\" in str(e):\n        raise SystemExit(\"Swap in an SD1 controlnet or use the SDXL base model\")\n    raise","preventionTips":["Match controlnet family to base checkpoint family before building the workflow.","Treat num_classes is not None as 'SDXL-style' when wiring conditioning."],"tags":["controlnet","sdxl","model-mismatch"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}