{"record":{"id":"517e96d9f5fcc477","repo":"Comfy-Org/ComfyUI","slug":"need-at-least-require-count-hooks-to-combine-bu","errorCode":null,"errorMessage":"Need at least {require_count} hooks to combine, but only had {len(actual)}.","messagePattern":"Need at least (.+?) hooks to combine, but only had (.+?)\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"comfy/hooks.py","lineNumber":410,"sourceCode":"                    if stored_range[0] < t_range[1] and stored_range[1] > t_range[0]:\n                        keyframe = stored_kf\n                        break\n                hooks_schedule.append((hook, keyframe))\n            scheduled_keyframes.append((t_range, hooks_schedule))\n        return scheduled_keyframes\n\n    def reset(self):\n        for hook in self.hooks:\n            hook.reset()\n\n    @staticmethod\n    def combine_all_hooks(hooks_list: list[HookGroup], require_count=0) -> HookGroup:\n        actual: list[HookGroup] = []\n        for group in hooks_list:\n            if group is not None:\n                actual.append(group)\n        if len(actual) < require_count:\n            raise Exception(f\"Need at least {require_count} hooks to combine, but only had {len(actual)}.\")\n        # if no hooks, then return None\n        if len(actual) == 0:\n            return None\n        # if only 1 hook, just return itself without cloning\n        elif len(actual) == 1:\n            return actual[0]\n        final_hook: HookGroup = None\n        for hook in actual:\n            if final_hook is None:\n                final_hook = hook.clone()\n            else:\n                final_hook = final_hook.clone_and_combine(hook)\n        return final_hook\n\n\nclass HookKeyframe:\n    def __init__(self, strength: float, start_percent=0.0, guarantee_steps=1):\n        self.strength = strength","sourceCodeStart":392,"sourceCodeEnd":428,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/hooks.py#L392-L428","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure every conditioning input that feeds the combine node has a hook applied (Set Hooks / Create Hook Keyframe chain on each branch)","Pass None (or omit) for inputs without hooks instead of empty placeholder HookGroups when calling combine_all_hooks programmatically with a lower require_count","If a branch legitimately has no hooks, call combine_all_hooks with require_count equal to the number of branches that do"],"exampleFix":"# before\ncombined = HookGroup.combine_all_hooks([c1_hooks, c2_hooks, c3_hooks], require_count=3)  # c3_hooks is None\n# after\ncombined = HookGroup.combine_all_hooks([c1_hooks, c2_hooks, c3_hooks], require_count=2)","handlingStrategy":"validation","validationCode":"actual = [g for g in hooks_list if g is not None]\nassert len(actual) >= require_count, f'{len(actual)} hook groups < required {require_count}'\ncombined = HookGroup.combine_all_hooks(hooks_list, require_count=require_count)","typeGuard":null,"tryCatchPattern":"try:\n    combined = HookGroup.combine_all_hooks(hooks_list, require_count=require_count)\nexcept Exception:\n    combined = HookGroup.combine_all_hooks(hooks_list, require_count=0)","preventionTips":["Apply a Set Hooks node on every conditioning branch feeding a combine","Count non-None groups yourself before calling combine_all_hooks"],"tags":["hooks","conditioning","validation","workflow"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}