{"record":{"id":"85705edc083ff8b9","repo":"Comfy-Org/ComfyUI","slug":"vaeencodeaudio-input-audio-is-none-source-video","errorCode":null,"errorMessage":"VAEEncodeAudio: input audio is None (source video may have no audio track).","messagePattern":"VAEEncodeAudio: input audio is None \\(source video may have no audio track\\)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_extras/nodes_audio.py","lineNumber":84,"sourceCode":"class VAEEncodeAudio(IO.ComfyNode):\n    @classmethod\n    def define_schema(cls):\n        return IO.Schema(\n            node_id=\"VAEEncodeAudio\",\n            search_aliases=[\"audio to latent\"],\n            display_name=\"VAE Encode Audio\",\n            category=\"model/latent\",\n            inputs=[\n                IO.Audio.Input(\"audio\"),\n                IO.Vae.Input(\"vae\"),\n            ],\n            outputs=[IO.Latent.Output()],\n        )\n\n    @classmethod\n    def execute(cls, vae, audio) -> IO.NodeOutput:\n        if audio is None:\n            raise ValueError(\"VAEEncodeAudio: input audio is None (source video may have no audio track).\")\n        sample_rate = audio[\"sample_rate\"]\n        vae_sample_rate = getattr(vae, \"audio_sample_rate\", 44100)\n        if vae_sample_rate != sample_rate:\n            waveform = torchaudio.functional.resample(audio[\"waveform\"], sample_rate, vae_sample_rate)\n        else:\n            waveform = audio[\"waveform\"]\n\n        t = vae.encode(waveform.movedim(1, -1))\n        return IO.NodeOutput({\"samples\": t})\n\n    encode = execute  # TODO: remove\n\n\ndef vae_decode_audio(vae, samples, tile=None, overlap=None):\n    latent = samples[\"samples\"]\n    if latent.is_nested:\n        latent = latent.unbind()[-1]\n","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_extras/nodes_audio.py#L66-L102","documentation":"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.","triggerScenarios":"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.","commonSituations":"Batch workflows that mix videos with and without audio tracks; silent screen recordings; MKV/MP4 remuxes that dropped the audio stream.","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"],"exampleFix":"// before\nVAEEncodeAudio(audio=video_audio_output, vae=vae)\n\n// after\n# gate the branch: only encode when the video actually has audio\nSwitch(audio=video_audio_output, select=1 if video_audio_output is not None else 0)","handlingStrategy":"type-guard","validationCode":"def has_audio(audio) -> bool:\n    return audio is not None and 'waveform' in audio and audio['waveform'] is not None","typeGuard":"from typing import Any, TypedDict\n\nclass Audio(TypedDict):\n    waveform: Any\n    sample_rate: int\n\ndef is_audio(v) -> bool:\n    return isinstance(v, dict) and 'waveform' in v and 'sample_rate' in v","tryCatchPattern":null,"preventionTips":["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"],"tags":["audio","vae","none-input","workflow"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}