Comfy-Org/ComfyUI · error · ValueError

Keyframe times must be numbers in seconds, comma-separated;

Error message

Keyframe times must be numbers in seconds, comma-separated; got '{value}'.

What it means

Each comma-separated keyframe time must parse as a float. float(part) failing (letters, malformed numbers, locale decimal commas like '2,5' surviving a split) raises this ValueError chained from the original parse error.

Source

Thrown at comfy_api_nodes/nodes_bfl.py:1066

            flat.append(tensor)
    if len(flat) > _FLUX3_MAX_IMAGES:
        raise ValueError(f"FLUX 3 supports at most {_FLUX3_MAX_IMAGES} {field_name}, got {len(flat)}.")
    for tensor in flat:
        _flux3_validate_image(tensor)
    return flat


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

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Use plain dot-decimal seconds: '0, 2.5, 5.0'.
  2. Strip units and spaces from generated time strings.
  3. Generate the string programmatically: ','.join(f'{t}' for t in times).

Example fix

# before
keyframe_times = "0s, 5s"  # ValueError: not numbers

# after
keyframe_times = "0, 5"
Defensive patterns

Strategy: try-catch

Validate before calling

try:
    [float(p) for p in value.split(",")]
except ValueError:
    raise ValueError(f"times must be numeric: {value!r}")

Type guard

def times_parseable(value: str) -> bool:
    try:
        return all(True for _ in (float(p) for p in value.split(",")))
    except ValueError:
        return False

Try / catch

try:
    times = _flux3_parse_times(value, n, duration)
except ValueError as e:
    if "must be numbers" in str(e):
        times = _flux3_parse_times(sanitize(value), n, duration)

Prevention

When it happens

Trigger: Passing times like 'one,two', '3..5', or locale-formatted values; also '2,5 s' style strings with units or stray characters.

Common situations: Hand-typed widget values; localized number formatting; stray units ('s', 'sec') pasted from documentation examples.

Related errors


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