Comfy-Org/ComfyUI · error · ValueError

Minimum cutoff must be larger than zero.

Error message

Minimum cutoff must be larger than zero.

What it means

Raised by LowPassFilter1d.__init__ when the anti-aliasing low-pass cutoff passed to the vocoder (BigVGAN-style alias-free filter) is negative. The filter is a Kaiser-windowed sinc where cutoff is a normalized frequency (0 to 0.5 of Nyquist), so a negative value is meaningless. This is a constructor/config validation error: the check fires at model build time, before any tensor work.

Source

Thrown at comfy/ldm/lightricks/vocoders/vocoder.py:68

        filter_ = 2 * cutoff * window * _sinc(2 * cutoff * time)
        filter_ /= filter_.sum()
        filter = filter_.view(1, 1, kernel_size)
    return filter


class LowPassFilter1d(nn.Module):
    def __init__(
        self,
        cutoff=0.5,
        half_width=0.6,
        stride=1,
        padding=True,
        padding_mode="replicate",
        kernel_size=12,
    ):
        super().__init__()
        if cutoff < -0.0:
            raise ValueError("Minimum cutoff must be larger than zero.")
        if cutoff > 0.5:
            raise ValueError("A cutoff above 0.5 does not make sense.")
        self.kernel_size = kernel_size
        self.even = kernel_size % 2 == 0
        self.pad_left = kernel_size // 2 - int(self.even)
        self.pad_right = kernel_size // 2
        self.stride = stride
        self.padding = padding
        self.padding_mode = padding_mode
        filter = kaiser_sinc_filter1d(cutoff, half_width, kernel_size)
        self.register_buffer("filter", filter)

    def forward(self, x):
        _, C, _ = x.shape
        if self.padding:
            x = F.pad(x, (self.pad_left, self.pad_right), mode=self.padding_mode)
        return F.conv1d(x, comfy.model_management.cast_to(self.filter.expand(C, -1, -1), dtype=x.dtype, device=x.device), stride=self.stride, groups=C)

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Set cutoff to a value in [0, 0.5], e.g. the default 0.5
  2. Check the vocoder config file / kwargs chain that produces the LowPassFilter1d arguments
  3. If loading from a checkpoint, inspect the stored config JSON for a negative cutoff value

Example fix

// before
LowPassFilter1d(cutoff=-0.2)
// after
LowPassFilter1d(cutoff=0.2)
Defensive patterns

Strategy: validation

Validate before calling

cutoff = cfg.get('cutoff', 0.5)
if not (0.0 <= cutoff <= 0.5):
    raise ValueError(f'cutoff must be in [0, 0.5], got {cutoff}')
lpf = LowPassFilter1d(cutoff=cutoff)

Type guard

def is_valid_cutoff(c: float) -> bool:
    return isinstance(c, (int, float)) and 0.0 <= c <= 0.5

Prevention

When it happens

Trigger: Instantiating LowPassFilter1d (directly or via the lightricks vocoder) with cutoff < 0, e.g. from a modified vocoder config JSON or an explicitly passed negative argument.

Common situations: Editing a vocoder checkpoint config to tune the low-pass and typing a negative cutoff; copy-pasting configs from another repo that uses a different cutoff convention; programmatic config generation that defaults unset numbers to -1.

Related errors


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