Comfy-Org/ComfyUI · error · ValueError

PreviewAudio: input audio is None (source video may have no

Error message

PreviewAudio: input audio is None (source video may have no audio track).

What it means

PreviewAudio.execute raises when audio is None. Preview nodes render audio in the UI, and a None (classically produced by LoadVideo on a silent video) cannot be previewed, so the node rejects it explicitly rather than erroring deeper in the UI layer.

Source

Thrown at comfy_extras/nodes_audio.py:317

    def define_schema(cls):
        return IO.Schema(
            node_id="PreviewAudio",
            search_aliases=["play audio"],
            display_name="Preview Audio",
            category="audio",
            description="Preview the audio without saving it to the ComfyUI output directory.",
            inputs=[
                IO.Audio.Input("audio"),
            ],
            hidden=[IO.Hidden.prompt, IO.Hidden.extra_pnginfo],
            is_output_node=True,
            outputs=[IO.Audio.Output("audio")]
        )

    @classmethod
    def execute(cls, audio) -> IO.NodeOutput:
        if audio is None:
            raise ValueError("PreviewAudio: input audio is None (source video may have no audio track).")
        return IO.NodeOutput(audio, ui=UI.PreviewAudio(audio, cls=cls))

    save_flac = execute  # TODO: remove


def f32_pcm(wav: torch.Tensor) -> torch.Tensor:
    """Convert audio to float 32 bits PCM format."""
    if wav.dtype.is_floating_point:
        return wav
    elif wav.dtype == torch.int16:
        return wav.float() / (2 ** 15)
    elif wav.dtype == torch.int32:
        return wav.float() / (2 ** 31)
    raise ValueError(f"Unsupported wav dtype: {wav.dtype}")

def load(filepath: str) -> tuple[torch.Tensor, int]:
    with av.open(filepath) as af:
        if not af.streams.audio:

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Use a source with a real audio track, verified via ffprobe
  2. Drive the preview from LoadAudio or a generator instead
  3. Bypass/switch off the preview node when the audio is None
Defensive patterns

Strategy: type-guard

Validate before calling

if audio is not None:
    preview(audio)  # only preview real audio

Type guard

def is_audio(v) -> bool:
    return isinstance(v, dict) and 'waveform' in v and 'sample_rate' in v

Prevention

When it happens

Trigger: Connecting a video loader's audio output (None because no audio track) to PreviewAudio; unconnected optional audio inputs in a partially wired graph.

Common situations: Debugging pipelines on silent test clips; previewing after a trim/split operation that returned None for empty input.

Related errors


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