{"record":{"id":"e9f799c6f13c8e75","repo":"Comfy-Org/ComfyUI","slug":"control-type-max-type-name-max-type-is-out-of","errorCode":null,"errorMessage":"Control type {max_type_name}({max_type}) is out of range for the number of control types({self.num_control_type}) supported.\nPlease consider using the ProMax ControlNet Union model.\nhttps://huggingface.co/xinsir/controlnet-union-sdxl-1.0/tree/main","messagePattern":"Control type (.+?)\\((.+?)\\) is out of range for the number of control types\\((.+?)\\) supported\\.\nPlease consider using the ProMax ControlNet Union model\\.\nhttps://huggingface\\.co/xinsir/controlnet-union-sdxl-1\\.0/tree/main","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy/cldm/cldm.py","lineNumber":396,"sourceCode":"        return controlnet_cond_fuser\n\n    def make_zero_conv(self, channels, operations=None, dtype=None, device=None):\n        return TimestepEmbedSequential(operations.conv_nd(self.dims, channels, channels, 1, padding=0, dtype=dtype, device=device))\n\n    def forward(self, x, hint, timesteps, context, y=None, **kwargs):\n        t_emb = timestep_embedding(timesteps, self.model_channels, repeat_only=False).to(x.dtype)\n        emb = self.time_embed(t_emb)\n\n        guided_hint = None\n        if self.control_add_embedding is not None: #Union Controlnet\n            control_type = kwargs.get(\"control_type\", [])\n\n            if any([c >= self.num_control_type for c in control_type]):\n                max_type = max(control_type)\n                max_type_name = {\n                    v: k for k, v in UNION_CONTROLNET_TYPES.items()\n                }[max_type]\n                raise ValueError(\n                    f\"Control type {max_type_name}({max_type}) is out of range for the number of control types\" +\n                    f\"({self.num_control_type}) supported.\\n\" +\n                    \"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","sourceCodeStart":378,"sourceCodeEnd":414,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/cldm/cldm.py#L378-L414","documentation":"For Union ControlNets, ControlNet.forward validates each element of the control_type list against self.num_control_type (the number of union types the loaded model was trained with, mapped via UNION_CONTROLNET_TYPES). A type id >= num_control_type (e.g. the ProMax-only types like 'repaint' or deeper ids) cannot be embedded by this model, so it raises ValueError naming the offending type and suggesting the ProMax union model.","triggerScenarios":"Using a standard xinsir controlnet-union-sdxl model but selecting an advanced control type (e.g. Control types beyond the model's supported set such as depth+normal/repaint variants only in ProMax); passing raw numeric control_type values from a custom node without clamping.","commonSituations":"Newer Union ProMax workflows run against the older union-sdxl-1.0 checkpoint; custom nodes emitting control_type indices above the model's range; mixed up model files.","solutions":["Download and use the ProMax ControlNet Union model referenced in the message (xinsir/controlnet-union-sdxl-1.0 on HuggingFace).","Or keep the current model and select only control types it supports (openpose/depth/seg/canny/tile/etc. — check UNION_CONTROLNET_TYPES and the model's num_control_type).","If writing a node, validate control_type entries < model.num_control_type before forward."],"exampleFix":"# before: standard union model, ProMax-only type selected\nunion_controlnet_apply(control_type=[8])  # repaint, ProMax only\n\n# after: supported type for this checkpoint\nunion_controlnet_apply(control_type=[2])  # depth","handlingStrategy":"validation","validationCode":"control_type = [t for t in control_type if t < controlnet.num_control_type]\nif not control_type:\n    raise SystemExit(\"selected control types exceed this union model; use ProMax\")","typeGuard":"def control_types_supported(controlnet, types: list[int]) -> bool:\n    return all(t < controlnet.num_control_type for t in types)","tryCatchPattern":"try:\n    control = controlnet(x_noisy, hint, timesteps, context, control_type=control_type)\nexcept ValueError as e:\n    if \"out of range\" in str(e):\n        raise SystemExit(\"Load the ProMax ControlNet Union model for this control type\")\n    raise","preventionTips":["Check num_control_type of the loaded union model before selecting advanced types.","Pair ProMax-only control types only with the ProMax checkpoint."],"tags":["controlnet","model-loading","sdxl","validation"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}