Comfy-Org/ComfyUI · error · ValueError

Keyframe time {times[-1]}s is past the end of a {cap}s clip.

Error message

Keyframe time {times[-1]}s is past the end of a {cap}s clip.

What it means

The last keyframe time must fall inside the generated clip: it is compared against cap = 20 (duration 'auto') or the chosen integer duration in seconds. A final keyframe past the end would reference a moment the video never reaches.

Source

Thrown at comfy_api_nodes/nodes_bfl.py:1075

    """Parse one keyframe time in seconds per image: increasing, inside the clip."""
    parts = [part.strip() for part in value.split(",") if part.strip()]
    if len(parts) != image_count:
        raise ValueError(
            f"Give one time per keyframe image: got {len(parts)} time(s) for {image_count} image(s)."
        )
    try:
        times = [float(part) for part in parts]
    except ValueError as exc:
        raise ValueError(f"Keyframe times must be numbers in seconds, comma-separated; got '{value}'.") from exc
    if not all(math.isfinite(time) for time in times):
        raise ValueError(f"Keyframe times must be finite numbers in seconds; got '{value}'.")
    if any(later <= earlier for earlier, later in zip(times, times[1:])):
        raise ValueError(f"Keyframe times must increase; got {times}.")
    if times[0] < 0:
        raise ValueError(f"Keyframe times cannot be negative; got {times[0]}.")
    cap = _FLUX3_MAX_DURATION if duration == "auto" else int(duration)
    if times[-1] > cap:
        raise ValueError(f"Keyframe time {times[-1]}s is past the end of a {cap}s clip.")
    return times


class Flux3VideoNodeBase(IO.ComfyNode):
    """Shared widgets, request plumbing and polling for the FLUX 3 generation modes."""

    RATE_HD: float
    RATE_FHD: float

    @classmethod
    def common_inputs(cls) -> list:
        return [
            IO.Combo.Input(
                "aspect_ratio",
                options=_FLUX3_ASPECT_RATIOS,
                default="auto",
                tooltip="Output aspect ratio. 'auto' picks one from the prompt and inputs.",
            ),

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Raise the duration setting to at least ceil(last_time) seconds.
  2. Or rescale/trim times so the last one is <= duration.
  3. Remember duration='auto' caps at 20 seconds, not infinity.

Example fix

# before
duration = "10"; keyframe_times = "0, 8, 16"  # 16 > 10 -> ValueError

# after
duration = "20"; keyframe_times = "0, 8, 16"
Defensive patterns

Strategy: validation

Validate before calling

cap = 20 if duration == "auto" else int(duration)
times = [float(p) for p in value.split(",")]
assert times[-1] <= cap, f"last keyframe {times[-1]}s exceeds {cap}s clip"

Type guard

def last_time_within_clip(times: list[float], duration: int | str) -> bool:
    cap = 20 if duration == "auto" else int(duration)
    return times[-1] <= cap

Prevention

When it happens

Trigger: Passing a times string whose largest value exceeds the duration setting — e.g. '0, 15, 18' with duration=10, or any value > 20 with duration='auto'.

Common situations: Lowering the duration widget after writing times; keeping times from a longer template clip; assuming 'auto' extends beyond 20s.

Related errors


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