BlackPatchRetryHookProvider
Give any detailer the same black-patch retry safety net
- DETAILER_HOOK
Impact Pack already ships a node called Detailer (SEGS) with auto retry that re-rolls a detected region if the refine pass collapses into a solid black patch - a real if occasional failure mode where a bad seed or an unstable checkpoint produces nothing but void. That behavior is baked into that one detailer node with a single max_retries knob. BlackPatchRetryHookProvider is the same protection, unbundled into a DETAILER_HOOK you can attach to any other detailer - plain FaceDetailer, DetailerDebug (SEGS), MaskDetailer (pipe) - that doesn't have retry logic wired in by default.
This is the same pattern as the pack's SEGSLabelFilterDetailerHookProvider: take a behavior that already exists as a standalone node and expose it as a hook, so any detailer can opt in without you swapping which node you're using.
How it works
The hook watches each refined region and decides whether it's "black" using two thresholds together, not one. mean_thresh catches how dark the patch is on average - a low mean means mostly dark or black pixels. var_thresh catches how flat it is - low variance means the patch has almost no detail, just a near-uniform color. Requiring both low is the point: a genuinely dark but detailed result (night scenes, dark hair, a shadowed corner) has real variance and won't trip a mean-only check, while an actual sampling collapse is both dark and flat. When a region fails that check, the detailer retries it rather than compositing the void back onto your image.
The inputs and output
mean_thresh(INT, default 10, range 0–255) - how low the average pixel value has to be before a patch is considered suspiciously dark. Low by design; you're catching near-black, not "kind of dark."var_thresh(INT, default 5, range 0–255) - how low the pixel variance has to be for the patch to count as flat/featureless. Combined withmean_thresh, both conditions have to hold for a retry to trigger.
Output is a single DETAILER_HOOK. Wire it into any detailer's detailer_hook input. If you want retry protection alongside another hook (a noise schedule, a preview hook), combine them first with DetailerHookCombine.
How to install it
Bundled with the pack. ComfyUI Manager: search ComfyUI Impact Pack, install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack comfyui-impact-pack
cd comfyui-impact-pack
python -m pip install -r requirements.txt # ComfyUI's python; python_embeded on portable
then restart. No models - pure post-sample logic.
Common issues & troubleshooting
This is a genuinely obscure corner of the pack - searching the community turns up essentially nothing written about it specifically, so you're mostly on the README and this article rather than crowd-sourced fixes. A few things worth knowing anyway:
Already using "Detailer (SEGS) with auto retry"? You don't need this hook too - that node has the same protection built in via its max_retries input. Reach for this hook specifically when you're on a different detailer variant that doesn't have retry logic of its own.
Retries keep happening and the region still comes back black. That's not something this hook can fix - retrying re-rolls the seed, but a systemically broken setup (a bad VAE, an fp16 overflow, a checkpoint incompatible with the crop size) will keep failing regardless of attempts. Chase the root cause rather than expecting the hook to paper over it.
A legitimately dark result keeps getting retried unnecessarily. Lower var_thresh further so only truly flat, featureless patches trip the check, or lower mean_thresh if your dark-but-detailed regions are still reading as "too dark" on average.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| mean_thresh | INT | 100–255 | — |
| var_thresh | INT | 50–255 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| DETAILER_HOOK | DETAILER_HOOK | — |