{"record":{"id":"e677036af6b9656d","repo":"Comfy-Org/ComfyUI","slug":"pose-video-has-frames-but-video-frame-offset-is","errorCode":null,"errorMessage":"pose_video has {} frames but video_frame_offset is {} -- nothing left to read.","messagePattern":"pose_video has (.+?) frames but video_frame_offset is (.+?) -- nothing left to read\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_extras/nodes_wan.py","lineNumber":1343,"sourceCode":"        mask[:, :, :trim_latent + ref_motion_latent_length] = 0.0\n\n        positive = node_helpers.conditioning_set_values(positive, {\"concat_latent_image\": concat_latent_image, \"concat_mask\": mask})\n        negative = node_helpers.conditioning_set_values(negative, {\"concat_latent_image\": concat_latent_image, \"concat_mask\": mask})\n\n        if clip_vision_output is not None:\n            positive = node_helpers.conditioning_set_values(positive, {\"clip_vision_output\": clip_vision_output})\n            negative = node_helpers.conditioning_set_values(negative, {\"clip_vision_output\": clip_vision_output})\n\n        # not windowed with the pose values: the reference frame is part of the latent on every step\n        if reference_image_strength != 1.0:\n            positive = node_helpers.conditioning_set_values(positive, {\"reference_strength\": reference_image_strength})\n            negative = node_helpers.conditioning_set_values(negative, {\"reference_strength\": reference_image_strength})\n\n        # set on the negative too: upstream runs the pose branch once, outside the CFG loop, so it never sees the negative prompt\n        pose_values = {}\n        if pose_video is not None:\n            if pose_video.shape[0] <= video_frame_offset:\n                raise ValueError(\"pose_video has {} frames but video_frame_offset is {} -- nothing left to read.\".format(pose_video.shape[0], video_frame_offset))\n            pose_video = pose_video[video_frame_offset:]\n            pose_video = comfy.utils.common_upscale(pose_video[:length].movedim(-1, 1), width, height, \"area\", \"center\").movedim(1, -1)\n            if pose_video.shape[0] < length:  # hold the last frame, as upstream pads its clips\n                pose_video = torch.cat((pose_video,) + (pose_video[-1:],) * (length - pose_video.shape[0]), dim=0)\n            pose_values[\"pose_video_latent\"] = vae.encode(pose_video[:, :, :, :3])\n\n        pose_clip = clip_vision_output_pose if clip_vision_output_pose is not None else clip_vision_output\n        if pose_clip is not None:\n            pose_values[\"clip_vision_output_pose\"] = pose_clip\n\n        pose_cond = positive_pose if positive_pose is not None else positive\n        if len(pose_cond) > 0:\n            pose_values[\"cross_attn_pose\"] = pose_cond[0][0]\n\n        if pose_strength != 1.0:\n            pose_values[\"pose_strength\"] = pose_strength\n\n        if pose_start_percent > 0.0 or pose_end_percent < 1.0:","sourceCodeStart":1325,"sourceCodeEnd":1361,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_extras/nodes_wan.py#L1325-L1361","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set video_frame_offset < pose_video.shape[0] (count frames first)","Compute the offset from the segment index: offset = segment_index * (length - overlap) and stop when it reaches the frame count","Verify the pose tensor actually contains the frames you think it does"],"exampleFix":"# before\nout = node.execute(..., video_frame_offset=300)  # pose_video has 240 frames\n\n# after\noffset = min(300, pose_video.shape[0] - 1)\nout = node.execute(..., video_frame_offset=offset)","handlingStrategy":"validation","validationCode":"video_frame_offset = min(video_frame_offset, pose_video.shape[0] - 1)\nassert pose_video.shape[0] > 0","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Compute offsets from segment index and stop when offset reaches the frame count","Print pose_video.shape[0] when building multi-segment pipelines"],"tags":["wan","pose-control","video","offset"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}