Comfy-Org/ComfyUI · error · ValueError
Control type ( ) is out of range for the number of control…
Error message
Control type {max_type_name}({max_type}) is out of range for the number of control types({self.num_control_type}) supported.
Please consider using the ProMax ControlNet Union model.
https://huggingface.co/xinsir/controlnet-union-sdxl-1.0/tree/main What it means
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.
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.
Example fix
# before: standard union model, ProMax-only type selected union_controlnet_apply(control_type=[8]) # repaint, ProMax only # after: supported type for this checkpoint union_controlnet_apply(control_type=[2]) # depth
Defensive patterns
Strategy: validation
Validate before calling
control_type = [t for t in control_type if t < controlnet.num_control_type]
if not control_type:
raise SystemExit("selected control types exceed this union model; use ProMax") Type guard
def control_types_supported(controlnet, types: list[int]) -> bool:
return all(t < controlnet.num_control_type for t in types) Try / catch
try:
control = controlnet(x_noisy, hint, timesteps, context, control_type=control_type)
except ValueError as e:
if "out of range" in str(e):
raise SystemExit("Load the ProMax ControlNet Union model for this control type")
raise Prevention
- Check num_control_type of the loaded union model before selecting advanced types.
- Pair ProMax-only control types only with the ProMax checkpoint.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- CORRUPTED MODEL: one of the q-k-v values for the text…
- floats_strength must be either an iterable input or a…
- INVALID_TAG_FILTER
- provide num_res_blocks either as an int (globally constant)…
- Qwen Fun ControlNet requires a control hint image.
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/e9f799c6f13c8e75.
Report an issue: GitHub.
Appendix: source
Thrown at comfy/cldm/cldm.py:396
return controlnet_cond_fuser
def make_zero_conv(self, channels, operations=None, dtype=None, device=None):
return TimestepEmbedSequential(operations.conv_nd(self.dims, channels, channels, 1, padding=0, dtype=dtype, device=device))
def forward(self, x, hint, timesteps, context, y=None, **kwargs):
t_emb = timestep_embedding(timesteps, self.model_channels, repeat_only=False).to(x.dtype)
emb = self.time_embed(t_emb)
guided_hint = None
if self.control_add_embedding is not None: #Union Controlnet
control_type = kwargs.get("control_type", [])
if any([c >= self.num_control_type for c in control_type]):
max_type = max(control_type)
max_type_name = {
v: k for k, v in UNION_CONTROLNET_TYPES.items()
}[max_type]
raise ValueError(
f"Control type {max_type_name}({max_type}) is out of range for the number of control types" +
f"({self.num_control_type}) supported.\n" +
"Please consider using the ProMax ControlNet Union model.\n" +
"https://huggingface.co/xinsir/controlnet-union-sdxl-1.0/tree/main"
)
emb += self.control_add_embedding(control_type, emb.dtype, emb.device)
if len(control_type) > 0:
if len(hint.shape) < 5:
hint = hint.unsqueeze(dim=0)
guided_hint = self.union_controlnet_merge(hint, control_type, emb, context)
if guided_hint is None:
guided_hint = self.input_hint_block(hint, emb, context)
out_output = []
out_middle = []
View on GitHub (pinned to 1c6d8d45b3)