Comfy-Org/ComfyUI · error · ValueError

Keyframe times cannot be negative; got {times[0]}.

Error message

Keyframe times cannot be negative; got {times[0]}.

What it means

The first keyframe time defines the clip start offset and cannot be negative; times[0] < 0 is rejected. Negative lead-in times have no meaning in the FLUX 3 timeline model.

Source

Thrown at comfy_api_nodes/nodes_bfl.py:1072


def _flux3_parse_times(value: str, image_count: int, duration: int | str) -> list[float]:
    """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,

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Clamp the first time to >= 0: times[0] = max(times[0], 0.0).
  2. Re-base offsets so the earliest keyframe is at 0.
  3. Check sign conventions in upstream time computation.

Example fix

# before
keyframe_times = "-2, 3, 7"  # ValueError

# after
times = [max(0.0, t) for t in times]
keyframe_times = ", ".join(str(t) for t in times)
Defensive patterns

Strategy: validation

Validate before calling

times = [float(p) for p in value.split(",")]
assert times[0] >= 0, f"negative first keyframe {times[0]}"

Type guard

def first_time_non_negative(times: list[float]) -> bool:
    return times[0] >= 0

Prevention

When it happens

Trigger: Passing a leading negative value such as '-2, 3, 7'; typically from offset math or sign typos.

Common situations: Computing times relative to an event that starts before the clip; copy-paste sign errors.

Related errors


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