Comfy-Org/ComfyUI · error · ValueError

Unknown resblock type: {self.resblock}

Error message

Unknown resblock type: {self.resblock}

What it means

Raised by the lightricks vocoder constructor when its resblock discriminator/generator setting is not one of the supported strings: '1' (ResBlock1), '2' (ResBlock2), or 'AMP1' (AMPBlock1). It is a config-driven dispatch: the resblock type string comes from the vocoder config and must match exactly. Any other value aborts model construction.

Source

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

        # preprocessing.stft.hop_length (see CausalAudioAutoencoder).
        self.output_sample_rate = config.get("output_sample_rate")
        self.resblock = config.get("resblock", "1")
        self.use_tanh_at_final = config.get("use_tanh_at_final", True)
        self.apply_final_activation = config.get("apply_final_activation", True)
        self.num_kernels = len(resblock_kernel_sizes)
        self.num_upsamples = len(upsample_rates)

        in_channels = 128 if stereo else 64
        self.conv_pre = ops.Conv1d(in_channels, upsample_initial_channel, 7, 1, padding=3)

        if self.resblock == "1":
            resblock_cls = ResBlock1
        elif self.resblock == "2":
            resblock_cls = ResBlock2
        elif self.resblock == "AMP1":
            resblock_cls = AMPBlock1
        else:
            raise ValueError(f"Unknown resblock type: {self.resblock}")

        self.ups = nn.ModuleList()
        for i, (u, k) in enumerate(zip(upsample_rates, upsample_kernel_sizes)):
            self.ups.append(
                ops.ConvTranspose1d(
                    upsample_initial_channel // (2**i),
                    upsample_initial_channel // (2 ** (i + 1)),
                    k,
                    u,
                    padding=(k - u) // 2,
                )
            )

        self.resblocks = nn.ModuleList()
        for i in range(len(self.ups)):
            ch = upsample_initial_channel // (2 ** (i + 1))
            for k, d in zip(resblock_kernel_sizes, resblock_dilation_sizes):
                if self.resblock == "AMP1":

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Set resblock to '1', '2', or 'AMP1' in the vocoder config
  2. Check for case/spacing: the value must be exactly one of the three strings
  3. If the checkpoint came from another codebase, port its resblock name to the closest supported type here

Example fix

# before
vocoder = Vocoder(resblock='AMP2')
# after
vocoder = Vocoder(resblock='AMP1')
Defensive patterns

Strategy: validation

Validate before calling

VALID_RESBLOCKS = {'1', '2', 'AMP1'}
if cfg['resblock'] not in VALID_RESBLOCKS:
    raise ValueError(f"resblock must be one of {sorted(VALID_RESBLOCKS)}, got {cfg['resblock']!r}")

Type guard

def is_valid_resblock(name: str) -> bool:
    return name in {'1', '2', 'AMP1'}

Prevention

When it happens

Trigger: Building the vocoder with resblock set to a value like 'AMP2', '3', 'resblock1' (wrong case), or None. Note the check is string-based and case-sensitive.

Common situations: Loading a vocoder checkpoint whose config was saved by a newer/older upstream version supporting more resblock types; manually editing config YAML/JSON; upstream BigVGAN configs that use 'AMPBlock' naming conventions different from this repo's strings.

Related errors


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