Comfy-Org/ComfyUI · error · ValueError
{label} {value:.2f}s exceeds the input video duration ({vide
Error message
{label} {value:.2f}s exceeds the input video duration ({video_duration:.2f}s). What it means
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.
Source
Thrown at comfy_api_nodes/nodes_runway.py:789
try:
fps = float(video.get_frame_rate())
except Exception:
fps = None
if fps is not None and fps > 30.0 + 0.01:
raise ValueError(f"Input video frame rate ({fps:.2f} fps) exceeds Aleph2's maximum of 30 fps.")
if (keyframes and keyframes.items) and (prompt_images and prompt_images.items):
raise ValueError("Aleph2 accepts either keyframes or prompt images, not both.")
video_duration: float | None = None
try:
video_duration = video.get_duration()
except Exception:
video_duration = None
def _check_seconds(value: float, label: str) -> None:
if video_duration is not None and value > video_duration + 0.0001:
raise ValueError(f"{label} {value:.2f}s exceeds the input video duration ({video_duration:.2f}s).")
video_url = await upload_video_to_comfyapi(cls, video)
keyframe_models: list[RunwayAleph2KeyframeSeconds | RunwayAleph2KeyframeAt] = []
if keyframes is not None:
if len(keyframes.items) > 5:
raise ValueError("Aleph2 supports at most 5 keyframes.")
for item in keyframes.items:
image_url = await upload_image_to_comfyapi(cls, item.image, mime_type="image/png")
if item.mode == KEYFRAME_MODE_SECONDS:
_check_seconds(item.value, "Keyframe timestamp")
keyframe_models.append(RunwayAleph2KeyframeSeconds(seconds=item.value, uri=image_url))
else:
keyframe_models.append(RunwayAleph2KeyframeAt(at=item.value, uri=image_url))
prompt_image_models: list[RunwayAleph2PromptImage] = []
if prompt_images is not None:
if len(prompt_images.items) > 5:View on GitHub (pinned to 1c6d8d45b3)
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
Example fix
# before RunwayAleph2KeyframeSeconds(seconds=12.0, ...) # video is 10s # after RunwayAleph2KeyframeSeconds(seconds=9.5, ...) # within duration
Defensive patterns
Strategy: validation
Validate before calling
try:
duration = video.get_duration()
except Exception:
duration = None
if duration is not None:
for item in keyframes.items + prompt_images.items:
if getattr(item, "mode", None) == "seconds" and item.value > duration + 0.0001:
raise ValueError(f"timestamp {item.value}s out of range (video {duration:.2f}s)") Type guard
def timestamps_within_duration(video, items) -> bool:
try:
d = video.get_duration()
except Exception:
return True
return all(i.value <= d + 0.0001 for i in items if getattr(i, "mode", None) == "seconds") Try / catch
try:
await aleph2_execute(...)
except ValueError as e:
if "exceeds the input video duration" in str(e):
clamp_timestamps(keyframes, prompt_images, duration) # then retry
else:
raise Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Input video frame rate ({fps:.2f} fps) exceeds Aleph2's maxi
- Aleph2 accepts either keyframes or prompt images, not both.
- Aleph2 supports at most 5 keyframes.
- Aleph2 supports at most 5 prompt images.
- ar_video sampler requires 5-D video latents [B,C,T,H,W], got
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/72b7fb8e0564ad7e.
Report an issue: GitHub.