Comfy-Org/ComfyUI · error · ValueError

pose_video has {} frames but video_frame_offset is {} -- not

Error message

pose_video has {} frames but video_frame_offset is {} -- nothing left to read.

What it means

Before encoding the pose video, the Wan node slices pose_video[video_frame_offset:] and requires at least one frame to remain after the offset. If video_frame_offset >= pose_video.shape[0], the slice would be empty and VAE encoding would fail downstream, so it raises with both numbers.

Source

Thrown at comfy_extras/nodes_wan.py:1343

        mask[:, :, :trim_latent + ref_motion_latent_length] = 0.0

        positive = node_helpers.conditioning_set_values(positive, {"concat_latent_image": concat_latent_image, "concat_mask": mask})
        negative = node_helpers.conditioning_set_values(negative, {"concat_latent_image": concat_latent_image, "concat_mask": mask})

        if clip_vision_output is not None:
            positive = node_helpers.conditioning_set_values(positive, {"clip_vision_output": clip_vision_output})
            negative = node_helpers.conditioning_set_values(negative, {"clip_vision_output": clip_vision_output})

        # not windowed with the pose values: the reference frame is part of the latent on every step
        if reference_image_strength != 1.0:
            positive = node_helpers.conditioning_set_values(positive, {"reference_strength": reference_image_strength})
            negative = node_helpers.conditioning_set_values(negative, {"reference_strength": reference_image_strength})

        # set on the negative too: upstream runs the pose branch once, outside the CFG loop, so it never sees the negative prompt
        pose_values = {}
        if pose_video is not None:
            if pose_video.shape[0] <= video_frame_offset:
                raise ValueError("pose_video has {} frames but video_frame_offset is {} -- nothing left to read.".format(pose_video.shape[0], video_frame_offset))
            pose_video = pose_video[video_frame_offset:]
            pose_video = comfy.utils.common_upscale(pose_video[:length].movedim(-1, 1), width, height, "area", "center").movedim(1, -1)
            if pose_video.shape[0] < length:  # hold the last frame, as upstream pads its clips
                pose_video = torch.cat((pose_video,) + (pose_video[-1:],) * (length - pose_video.shape[0]), dim=0)
            pose_values["pose_video_latent"] = vae.encode(pose_video[:, :, :, :3])

        pose_clip = clip_vision_output_pose if clip_vision_output_pose is not None else clip_vision_output
        if pose_clip is not None:
            pose_values["clip_vision_output_pose"] = pose_clip

        pose_cond = positive_pose if positive_pose is not None else positive
        if len(pose_cond) > 0:
            pose_values["cross_attn_pose"] = pose_cond[0][0]

        if pose_strength != 1.0:
            pose_values["pose_strength"] = pose_strength

        if pose_start_percent > 0.0 or pose_end_percent < 1.0:

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Set video_frame_offset < pose_video.shape[0] (count frames first)
  2. Compute the offset from the segment index: offset = segment_index * (length - overlap) and stop when it reaches the frame count
  3. Verify the pose tensor actually contains the frames you think it does

Example fix

# before
out = node.execute(..., video_frame_offset=300)  # pose_video has 240 frames

# after
offset = min(300, pose_video.shape[0] - 1)
out = node.execute(..., video_frame_offset=offset)
Defensive patterns

Strategy: validation

Validate before calling

video_frame_offset = min(video_frame_offset, pose_video.shape[0] - 1)
assert pose_video.shape[0] > 0

Prevention

When it happens

Trigger: Setting video_frame_offset greater than or equal to the pose video's frame count — e.g. offset 300 on a 240-frame pose clip; also wrong-frame-count tensors built by a custom pose loader.

Common situations: Sequenced multi-segment generation where the offset advances per chunk but the last chunk's offset reaches the clip end; reusing one offset value across pose videos of different lengths.

Related errors


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