Comfy-Org/ComfyUI · error · Exception

Need at least {require_count} hooks to combine, but only had

Error message

Need at least {require_count} hooks to combine, but only had {len(actual)}.

What it means

Raised by HookGroup.combine_all_hooks when, after filtering out None entries from hooks_list, fewer groups remain than require_count. Callers (typically the Conditioning combine nodes) pass require_count to enforce that N conditioning inputs each actually carried hooks; the error means one or more inputs had no hooks attached.

Source

Thrown at comfy/hooks.py:410

                    if stored_range[0] < t_range[1] and stored_range[1] > t_range[0]:
                        keyframe = stored_kf
                        break
                hooks_schedule.append((hook, keyframe))
            scheduled_keyframes.append((t_range, hooks_schedule))
        return scheduled_keyframes

    def reset(self):
        for hook in self.hooks:
            hook.reset()

    @staticmethod
    def combine_all_hooks(hooks_list: list[HookGroup], require_count=0) -> HookGroup:
        actual: list[HookGroup] = []
        for group in hooks_list:
            if group is not None:
                actual.append(group)
        if len(actual) < require_count:
            raise Exception(f"Need at least {require_count} hooks to combine, but only had {len(actual)}.")
        # if no hooks, then return None
        if len(actual) == 0:
            return None
        # if only 1 hook, just return itself without cloning
        elif len(actual) == 1:
            return actual[0]
        final_hook: HookGroup = None
        for hook in actual:
            if final_hook is None:
                final_hook = hook.clone()
            else:
                final_hook = final_hook.clone_and_combine(hook)
        return final_hook


class HookKeyframe:
    def __init__(self, strength: float, start_percent=0.0, guarantee_steps=1):
        self.strength = strength

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Ensure every conditioning input that feeds the combine node has a hook applied (Set Hooks / Create Hook Keyframe chain on each branch)
  2. Pass None (or omit) for inputs without hooks instead of empty placeholder HookGroups when calling combine_all_hooks programmatically with a lower require_count
  3. If a branch legitimately has no hooks, call combine_all_hooks with require_count equal to the number of branches that do

Example fix

# before
combined = HookGroup.combine_all_hooks([c1_hooks, c2_hooks, c3_hooks], require_count=3)  # c3_hooks is None
# after
combined = HookGroup.combine_all_hooks([c1_hooks, c2_hooks, c3_hooks], require_count=2)
Defensive patterns

Strategy: validation

Validate before calling

actual = [g for g in hooks_list if g is not None]
assert len(actual) >= require_count, f'{len(actual)} hook groups < required {require_count}'
combined = HookGroup.combine_all_hooks(hooks_list, require_count=require_count)

Try / catch

try:
    combined = HookGroup.combine_all_hooks(hooks_list, require_count=require_count)
except Exception:
    combined = HookGroup.combine_all_hooks(hooks_list, require_count=0)

Prevention

When it happens

Trigger: Calling HookGroup.combine_all_hooks([g1, None, g3], require_count=3) — the None is dropped so only 2 groups count. In practice: using ConditioningCombine with three conditionings where one was created without any Set Hooks/Keyframe hooks node.

Common situations: Branching workflows where one conditioning path bypasses the hook application node; keyframe hook workflows where one branch has no ScheduleGuider hooks; recently converted workflows missing a hooks node on one input.

Related errors


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/517e96d9f5fcc477. Report an issue: GitHub.