Comfy-Org/ComfyUI · error · ValueError
Unsupported audio_channels: {audio_channels}
Error message
Unsupported audio_channels: {audio_channels} What it means
The vocoder wrapper handles decoder output of 1 channel (squeeze to mono vocoder input) or 2 channels (stereo); decoder.out_ch anything else (e.g. 4 or 6 from an unsupported checkpoint) has no defined vocoder path and run_vocoder refuses it.
Source
Thrown at comfy/ldm/lightricks/vae/audio_vae.py:197
target_length -= LATENT_DOWNSAMPLE_FACTOR - 1
return (
batch,
self.autoencoder.decoder.out_ch,
target_length,
self.autoencoder.mel_bins,
)
def num_of_latents_from_frames(self, frames_number: int, frame_rate: float) -> int:
return round((float(frames_number) / frame_rate) * self.latents_per_second)
def run_vocoder(self, mel_spec: torch.Tensor) -> torch.Tensor:
audio_channels = self.autoencoder.decoder.out_ch
vocoder_input = mel_spec.transpose(2, 3)
if audio_channels == 1:
vocoder_input = vocoder_input.squeeze(1)
elif audio_channels != 2:
raise ValueError(f"Unsupported audio_channels: {audio_channels}")
return self.vocoder(vocoder_input)
@property
def sample_rate(self) -> int:
return int(self.autoencoder.sampling_rate)
@property
def mel_hop_length(self) -> int:
return int(self.autoencoder.mel_hop_length)
@property
def mel_bins(self) -> int:
return int(self.autoencoder.mel_bins)
@property
def latent_channels(self) -> int:
return int(self.autoencoder.decoder.z_channels)View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Use a checkpoint whose audio decoder outputs 1 or 2 channels
- Re-convert/verify the checkpoint's decoder out_ch matches the vocoder's expected layout
- If out_ch is wrong from conversion, fix the conversion script rather than bypassing the check
Defensive patterns
Strategy: validation
Validate before calling
ch = audio_vae.autoencoder.decoder.out_ch
assert ch in (1, 2), f"unsupported decoder out_ch {ch}" Prevention
- Verify decoder.out_ch immediately after checkpoint load
- Only pair decoders with vocoders of matching channel layout
When it happens
Trigger: Loading an audio VAE checkpoint whose decoder out_ch is neither 1 nor 2 and then decoding latents through run_vocoder.
Common situations: Experimental or mis-converted audio checkpoints, or mixing a decoder with a vocoder built for a different channel layout.
Related errors
- Vocoder is missing upsample_factor; cannot infer output samp
- Input audio must have {expected_channels} channels, got {wav
- DurationHead requires at least one of video_tokens / audio_t
- Unsupported spatial_scale {scale}. Choose from {list(mapping
- Either spatial_upsample or temporal_upsample must be True
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/aef2074715a4fb8b.
Report an issue: GitHub.