{"record":{"id":"72b7fb8e0564ad7e","repo":"Comfy-Org/ComfyUI","slug":"label-value-2f-s-exceeds-the-input-video-durat","errorCode":null,"errorMessage":"{label} {value:.2f}s exceeds the input video duration ({video_duration:.2f}s).","messagePattern":"(.+?) (.+?)s exceeds the input video duration \\((.+?)s\\)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_runway.py","lineNumber":789,"sourceCode":"        try:\n            fps = float(video.get_frame_rate())\n        except Exception:\n            fps = None\n        if fps is not None and fps > 30.0 + 0.01:\n            raise ValueError(f\"Input video frame rate ({fps:.2f} fps) exceeds Aleph2's maximum of 30 fps.\")\n\n        if (keyframes and keyframes.items) and (prompt_images and prompt_images.items):\n            raise ValueError(\"Aleph2 accepts either keyframes or prompt images, not both.\")\n\n        video_duration: float | None = None\n        try:\n            video_duration = video.get_duration()\n        except Exception:\n            video_duration = None\n\n        def _check_seconds(value: float, label: str) -> None:\n            if video_duration is not None and value > video_duration + 0.0001:\n                raise ValueError(f\"{label} {value:.2f}s exceeds the input video duration ({video_duration:.2f}s).\")\n\n        video_url = await upload_video_to_comfyapi(cls, video)\n\n        keyframe_models: list[RunwayAleph2KeyframeSeconds | RunwayAleph2KeyframeAt] = []\n        if keyframes is not None:\n            if len(keyframes.items) > 5:\n                raise ValueError(\"Aleph2 supports at most 5 keyframes.\")\n            for item in keyframes.items:\n                image_url = await upload_image_to_comfyapi(cls, item.image, mime_type=\"image/png\")\n                if item.mode == KEYFRAME_MODE_SECONDS:\n                    _check_seconds(item.value, \"Keyframe timestamp\")\n                    keyframe_models.append(RunwayAleph2KeyframeSeconds(seconds=item.value, uri=image_url))\n                else:\n                    keyframe_models.append(RunwayAleph2KeyframeAt(at=item.value, uri=image_url))\n\n        prompt_image_models: list[RunwayAleph2PromptImage] = []\n        if prompt_images is not None:\n            if len(prompt_images.items) > 5:","sourceCodeStart":771,"sourceCodeEnd":807,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_runway.py#L771-L807","documentation":"Raised by the inner _check_seconds helper in the Aleph2 node when a keyframe or prompt-image timestamp in seconds exceeds the input video's duration (with a 0.0001 tolerance). The video duration is obtained via video.get_duration(); if that call fails the check is skipped entirely. It fires per-item before the images are uploaded.","triggerScenarios":"Setting a keyframe/prompt-image timestamp (seconds mode) larger than the video length, e.g. timestamp 12s on a 10s clip; only when get_duration() succeeds.","commonSituations":"Timestamps authored against a longer cut of the video; off-by-one rounding near the end of the clip; unit confusion between seconds and frames.","solutions":["Set timestamps strictly within the video duration (use duration - small epsilon for the final frame)","Re-check the actual duration of the source video and retime keyframes accordingly","If the timestamp should be relative, switch the item's mode to percentage/relative position instead of seconds"],"exampleFix":"# before\nRunwayAleph2KeyframeSeconds(seconds=12.0, ...)  # video is 10s\n\n# after\nRunwayAleph2KeyframeSeconds(seconds=9.5, ...)  # within duration","handlingStrategy":"validation","validationCode":"try:\n    duration = video.get_duration()\nexcept Exception:\n    duration = None\nif duration is not None:\n    for item in keyframes.items + prompt_images.items:\n        if getattr(item, \"mode\", None) == \"seconds\" and item.value > duration + 0.0001:\n            raise ValueError(f\"timestamp {item.value}s out of range (video {duration:.2f}s)\")","typeGuard":"def timestamps_within_duration(video, items) -> bool:\n    try:\n        d = video.get_duration()\n    except Exception:\n        return True\n    return all(i.value <= d + 0.0001 for i in items if getattr(i, \"mode\", None) == \"seconds\")","tryCatchPattern":"try:\n    await aleph2_execute(...)\nexcept ValueError as e:\n    if \"exceeds the input video duration\" in str(e):\n        clamp_timestamps(keyframes, prompt_images, duration)  # then retry\n    else:\n        raise","preventionTips":["Author timestamps against get_duration() of the exact file being sent","Leave a small epsilon below the true end time for final-frame markers","Use relative/percentage mode when only proportional position matters"],"tags":["runway","aleph2","timestamp","validation","video"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}