Comfy-Org/ComfyUI · error · RuntimeError

Hooks not implemented in ModelPatcherDynamic. Please remove

Error message

Hooks not implemented in ModelPatcherDynamic. Please remove --fast arguments form ComfyUI startup

What it means

ModelPatcherDynamic (enabled by --fast startup flags) does not implement hook weight patching; if a code path tries to attach hook weights to a key (patch_hook_weight_to_device with a key present in combined_patches), it raises RuntimeError telling the user to remove --fast arguments. This is a deliberate unsupported-combination guard, not an internal bug.

Source

Thrown at comfy/model_patcher.py:2167

            try:
                self.load(device_to, dirty=dirty)
            except Exception as e:
                self.detach()
                raise e
            #ModelPatcher::partially_load returns a number on what got loaded but
            #nothing in core uses this and we have no data in the Dynamic world. Hit
            #the custom node devs with a None rather than a 0 that would mislead any
            #logic they might have.
            return None

    def patch_cached_hook_weights(self, cached_weights: dict, key: str, memory_counter: MemoryCounter):
        assert False #Should be unreachable - we dont ever cache in the new implementation

    def patch_hook_weight_to_device(self, hooks: comfy.hooks.HookGroup, combined_patches: dict, key: str, original_weights: dict, memory_counter: MemoryCounter):
        if key not in combined_patches:
            return

        raise RuntimeError("Hooks not implemented in ModelPatcherDynamic. Please remove --fast arguments form ComfyUI startup")

    def unpatch_hooks(self, whitelist_keys_set: set[str]=None) -> None:
        pass

    def get_non_dynamic_delegate(self):
        model_patcher = self.clone(disable_dynamic=True, model_override=self.non_dynamic_delegate_model)
        self.non_dynamic_delegate_model = model_patcher.get_clone_model_override()
        return model_patcher


CoreModelPatcher = ModelPatcher

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Remove --fast arguments from the ComfyUI startup command and restart.
  2. Update the custom node — newer versions may avoid patch_hook_weight_to_device on dynamic patchers.
  3. If you need both hooks and dynamic speedups, check upstream for hook support in ModelPatcherDynamic.

Example fix

# before (startup)
python main.py --fast
# after
python main.py
Defensive patterns

Strategy: fallback

Validate before calling

try:
    patcher.patch_hook_weight_to_device(hooks, combined_patches, key, originals, counter)
except RuntimeError as e:
    if "Hooks not implemented in ModelPatcherDynamic" in str(e):
        raise RuntimeError("This workflow needs hooks; restart ComfyUI without --fast") from e
    raise

Type guard

def is_dynamic_patcher(patcher) -> bool:
    return isinstance(patcher, comfy.model_patcher.ModelPatcherDynamic)

Try / catch

try:
    apply_hooks(model)
except RuntimeError as e:
    if "ModelPatcherDynamic" in str(e) and "--fast" in str(e):
        logging.error("Hooks + --fast unsupported: remove --fast from startup args and restart")
    raise

Prevention

When it happens

Trigger: Starting ComfyUI with --fast flags and then using hooks (e.g. some IP-Adapter/LoRA-hook workflows or custom nodes that call set/add hooks on the model) that route through patch_hook_weight_to_device on a dynamic patcher.

Common situations: Combining --fast performance flags with hook-based custom nodes or workflows; version transitions where hooks were added after the dynamic patcher.

Related errors


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