Comfy-Org/ComfyUI · error · ValueError
Not enough previous frames provided.
Error message
Not enough previous frames provided.
What it means
The Wan audio-driven video node requires that when previous_frames is supplied, it contains at least motion_frame_count frames; those frames seed the motion context for continuation. Fewer frames than requested motion context cannot be padded meaningfully, so the node rejects up front.
Source
Thrown at comfy_extras/nodes_wan.py:1508
io.Int.Input("motion_frame_count", default=9, min=1, max=33, step=1, tooltip="Number of previous frames to use as motion context.", advanced=True),
io.Float.Input("audio_scale", default=1.0, min=-10.0, max=10.0, step=0.01),
io.Image.Input("previous_frames", optional=True),
],
outputs=[
io.Model.Output(display_name="model"),
io.Conditioning.Output(display_name="positive"),
io.Conditioning.Output(display_name="negative"),
io.Latent.Output(display_name="latent"),
io.Int.Output(display_name="trim_image"),
],
)
@classmethod
def execute(cls, mode: DCValues, model, model_patch, positive, negative, vae, width, height, length, audio_encoder_output_1, motion_frame_count,
start_image=None, previous_frames=None, audio_scale=None, clip_vision_output=None, audio_encoder_output_2=None, mask_1=None, mask_2=None) -> io.NodeOutput:
if previous_frames is not None and previous_frames.shape[0] < motion_frame_count:
raise ValueError("Not enough previous frames provided.")
if mode["mode"] == "two_speakers":
audio_encoder_output_2 = mode["audio_encoder_output_2"]
mask_1 = mode["mask_1"]
mask_2 = mode["mask_2"]
if audio_encoder_output_2 is not None:
if mask_1 is None or mask_2 is None:
raise ValueError("Masks must be provided if two audio encoder outputs are used.")
ref_masks = None
if mask_1 is not None and mask_2 is not None:
if audio_encoder_output_2 is None:
raise ValueError("Second audio encoder output must be provided if two masks are used.")
ref_masks = torch.cat([mask_1, mask_2])
latent = torch.zeros([1, 16, ((length - 1) // 4) + 1, height // 8, width // 8], device=comfy.model_management.intermediate_device())
if start_image is not None:View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Supply at least motion_frame_count previous frames (take the tail of the prior video)
- Lower motion_frame_count to fit the available previous frames
- Omit previous_frames entirely for a fresh generation instead of passing a too-short clip
Example fix
# before: 4 frames supplied, motion_frame_count=6 out = node.execute(..., previous_frames=last4, motion_frame_count=6) # after: tail of prior video sized to the context previous_frames = video[-motion_frame_count:] out = node.execute(..., previous_frames=previous_frames, motion_frame_count=6)
Defensive patterns
Strategy: validation
Validate before calling
if previous_frames is not None:
previous_frames = previous_frames[-motion_frame_count:]
assert previous_frames.shape[0] >= motion_frame_count, "clip shorter than motion context" Prevention
- Always take the tail N frames of the prior video for continuation inputs
- Adjust motion_frame_count down when continuing from very short clips
When it happens
Trigger: Connecting a short clip (e.g. 4 frames) to previous_frames while motion_frame_count is larger (e.g. 6 or more typical values like 25); leaving motion_frame_count at a high default while passing a brief continuation clip.
Common situations: Extending videos frame-by-frame or in short continuations; motion_frame_count sized for the original generation but the continuation clip is shorter; trimming the last-N frames incorrectly before feeding back.
Related errors
- At least one reference video or reference image must be prov
- Too many references ({len(media)}). The maximum total of ref
- At least one reference image must be provided.
- pose_start_percent ({}) must not be greater than pose_end_pe
- Masks must be provided if two audio encoder outputs are used
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/e8322033db455e6f.
Report an issue: GitHub.