{"record":{"id":"97749289b88c338e","repo":"Comfy-Org/ComfyUI","slug":"minimum-cutoff-must-be-larger-than-zero","errorCode":null,"errorMessage":"Minimum cutoff must be larger than zero.","messagePattern":"Minimum cutoff must be larger than zero\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy/ldm/lightricks/vocoders/vocoder.py","lineNumber":68,"sourceCode":"        filter_ = 2 * cutoff * window * _sinc(2 * cutoff * time)\n        filter_ /= filter_.sum()\n        filter = filter_.view(1, 1, kernel_size)\n    return filter\n\n\nclass LowPassFilter1d(nn.Module):\n    def __init__(\n        self,\n        cutoff=0.5,\n        half_width=0.6,\n        stride=1,\n        padding=True,\n        padding_mode=\"replicate\",\n        kernel_size=12,\n    ):\n        super().__init__()\n        if cutoff < -0.0:\n            raise ValueError(\"Minimum cutoff must be larger than zero.\")\n        if cutoff > 0.5:\n            raise ValueError(\"A cutoff above 0.5 does not make sense.\")\n        self.kernel_size = kernel_size\n        self.even = kernel_size % 2 == 0\n        self.pad_left = kernel_size // 2 - int(self.even)\n        self.pad_right = kernel_size // 2\n        self.stride = stride\n        self.padding = padding\n        self.padding_mode = padding_mode\n        filter = kaiser_sinc_filter1d(cutoff, half_width, kernel_size)\n        self.register_buffer(\"filter\", filter)\n\n    def forward(self, x):\n        _, C, _ = x.shape\n        if self.padding:\n            x = F.pad(x, (self.pad_left, self.pad_right), mode=self.padding_mode)\n        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)\n","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/ldm/lightricks/vocoders/vocoder.py#L50-L86","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set cutoff to a value in [0, 0.5], e.g. the default 0.5","Check the vocoder config file / kwargs chain that produces the LowPassFilter1d arguments","If loading from a checkpoint, inspect the stored config JSON for a negative cutoff value"],"exampleFix":"// before\nLowPassFilter1d(cutoff=-0.2)\n// after\nLowPassFilter1d(cutoff=0.2)","handlingStrategy":"validation","validationCode":"cutoff = cfg.get('cutoff', 0.5)\nif not (0.0 <= cutoff <= 0.5):\n    raise ValueError(f'cutoff must be in [0, 0.5], got {cutoff}')\nlpf = LowPassFilter1d(cutoff=cutoff)","typeGuard":"def is_valid_cutoff(c: float) -> bool:\n    return isinstance(c, (int, float)) and 0.0 <= c <= 0.5","tryCatchPattern":null,"preventionTips":["Validate normalized-frequency parameters at the config boundary, not at model construction","Keep vocoder configs as shipped; treat cutoff as normalized to Nyquist, never Hz"],"tags":["vocoder","audio","config","validation"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}