Comfy-Org/ComfyUI · error · ValueError
VAEEncodeAudio: input audio is None (source video may have n
Error message
VAEEncodeAudio: input audio is None (source video may have no audio track).
What it means
VAEEncodeAudio.execute raises this when the audio input object is None, which typically happens when a LoadVideo node extracted no audio track from the source video and passed the None through. The node cannot encode a latent from nothing, so it fails fast with an explanatory message.
Source
Thrown at comfy_extras/nodes_audio.py:84
class VAEEncodeAudio(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="VAEEncodeAudio",
search_aliases=["audio to latent"],
display_name="VAE Encode Audio",
category="model/latent",
inputs=[
IO.Audio.Input("audio"),
IO.Vae.Input("vae"),
],
outputs=[IO.Latent.Output()],
)
@classmethod
def execute(cls, vae, audio) -> IO.NodeOutput:
if audio is None:
raise ValueError("VAEEncodeAudio: input audio is None (source video may have no audio track).")
sample_rate = audio["sample_rate"]
vae_sample_rate = getattr(vae, "audio_sample_rate", 44100)
if vae_sample_rate != sample_rate:
waveform = torchaudio.functional.resample(audio["waveform"], sample_rate, vae_sample_rate)
else:
waveform = audio["waveform"]
t = vae.encode(waveform.movedim(1, -1))
return IO.NodeOutput({"samples": t})
encode = execute # TODO: remove
def vae_decode_audio(vae, samples, tile=None, overlap=None):
latent = samples["samples"]
if latent.is_nested:
latent = latent.unbind()[-1]
View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Use a video file that actually contains an audio track (verify with ffprobe)
- Insert a LoadAudio (or generated-audio) node instead of relying on the video's audio output
- Add a conditional/is-None switch (e.g. a boolean gate node) so the encode branch is skipped when audio is None
Example fix
// before VAEEncodeAudio(audio=video_audio_output, vae=vae) // after # gate the branch: only encode when the video actually has audio Switch(audio=video_audio_output, select=1 if video_audio_output is not None else 0)
Defensive patterns
Strategy: type-guard
Validate before calling
def has_audio(audio) -> bool:
return audio is not None and 'waveform' in audio and audio['waveform'] is not None Type guard
from typing import Any, TypedDict
class Audio(TypedDict):
waveform: Any
sample_rate: int
def is_audio(v) -> bool:
return isinstance(v, dict) and 'waveform' in v and 'sample_rate' in v Prevention
- Check audio is not None before wiring the encode branch
- Verify source videos contain audio with ffprobe before batch runs
- Gate the latent-audio branch with a switch node for mixed inputs
When it happens
Trigger: Wiring a video loader's audio output (empty because the MP4 has no audio stream) into VAEEncodeAudio's audio input. Also manually connecting an optional audio socket that received no value.
Common situations: Batch workflows that mix videos with and without audio tracks; silent screen recordings; MKV/MP4 remuxes that dropped the audio stream.
Related errors
- This Controlnet needs a VAE but none was provided, please us
- Minimum cutoff must be larger than zero.
- A cutoff above 0.5 does not make sense.
- MiniMax Music3 DAV cannot encode audio
- ERROR: VAE is invalid: None\n\nIf the VAE is from a checkpoi
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/85705edc083ff8b9.
Report an issue: GitHub.