{"record":{"id":"e8322033db455e6f","repo":"Comfy-Org/ComfyUI","slug":"not-enough-previous-frames-provided","errorCode":null,"errorMessage":"Not enough previous frames provided.","messagePattern":"Not enough previous frames provided\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_extras/nodes_wan.py","lineNumber":1508,"sourceCode":"                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),\n                io.Float.Input(\"audio_scale\", default=1.0, min=-10.0, max=10.0, step=0.01),\n                io.Image.Input(\"previous_frames\", optional=True),\n            ],\n            outputs=[\n                io.Model.Output(display_name=\"model\"),\n                io.Conditioning.Output(display_name=\"positive\"),\n                io.Conditioning.Output(display_name=\"negative\"),\n                io.Latent.Output(display_name=\"latent\"),\n                io.Int.Output(display_name=\"trim_image\"),\n            ],\n        )\n\n    @classmethod\n    def execute(cls, mode: DCValues, model, model_patch, positive, negative, vae, width, height, length, audio_encoder_output_1, motion_frame_count,\n                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:\n\n        if previous_frames is not None and previous_frames.shape[0] < motion_frame_count:\n            raise ValueError(\"Not enough previous frames provided.\")\n\n        if mode[\"mode\"] == \"two_speakers\":\n            audio_encoder_output_2 = mode[\"audio_encoder_output_2\"]\n            mask_1 = mode[\"mask_1\"]\n            mask_2 = mode[\"mask_2\"]\n\n        if audio_encoder_output_2 is not None:\n            if mask_1 is None or mask_2 is None:\n                raise ValueError(\"Masks must be provided if two audio encoder outputs are used.\")\n\n        ref_masks = None\n        if mask_1 is not None and mask_2 is not None:\n            if audio_encoder_output_2 is None:\n                raise ValueError(\"Second audio encoder output must be provided if two masks are used.\")\n            ref_masks = torch.cat([mask_1, mask_2])\n\n        latent = torch.zeros([1, 16, ((length - 1) // 4) + 1, height // 8, width // 8], device=comfy.model_management.intermediate_device())\n        if start_image is not None:","sourceCodeStart":1490,"sourceCodeEnd":1526,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_extras/nodes_wan.py#L1490-L1526","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before: 4 frames supplied, motion_frame_count=6\nout = node.execute(..., previous_frames=last4, motion_frame_count=6)\n\n# after: tail of prior video sized to the context\nprevious_frames = video[-motion_frame_count:]\nout = node.execute(..., previous_frames=previous_frames, motion_frame_count=6)","handlingStrategy":"validation","validationCode":"if previous_frames is not None:\n    previous_frames = previous_frames[-motion_frame_count:]\n    assert previous_frames.shape[0] >= motion_frame_count, \"clip shorter than motion context\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always take the tail N frames of the prior video for continuation inputs","Adjust motion_frame_count down when continuing from very short clips"],"tags":["wan","audio-video","continuation","validation"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}