Comfy-Org/ComfyUI · error · ValueError
Keyframe times must be finite numbers in seconds; got '{valu
Error message
Keyframe times must be finite numbers in seconds; got '{value}'. What it means
Keyframe times must be finite floats; math.isfinite rejects nan and inf. These would otherwise pass float() parsing but make clip timing undefined, so they are rejected explicitly.
Source
Thrown at comfy_api_nodes/nodes_bfl.py:1068
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
@classmethod
def common_inputs(cls) -> list:View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Sanitize computed times: skip or clamp non-finite values before formatting the string.
- Guard divisions: t = a / b if b else 0.0.
- Validate with math.isfinite before wiring the value in.
Example fix
# before times = [t / duration for t in offsets] # duration=0 -> inf -> ValueError # after times = [t / duration if duration else 0.0 for t in offsets] times = [min(t, cap) if math.isfinite(t) else 0.0 for t in times]
Defensive patterns
Strategy: validation
Validate before calling
import math
times = [float(p) for p in value.split(",")]
assert all(math.isfinite(t) for t in times), "non-finite keyframe time" Type guard
def times_finite(value: str) -> bool:
import math
try:
return all(math.isfinite(float(p)) for p in value.split(","))
except ValueError:
return False Prevention
- Guard divisions used to compute times.
- Clamp or replace non-finite values before formatting.
- Check math.isfinite on computed offsets.
When it happens
Trigger: Passing 'nan', 'inf', '-inf', or arithmetic that evaluates to them (e.g. division by zero when building the string programmatically) in the keyframe times string.
Common situations: Computing times from user parameters where a zero duration divides to inf; string-building bugs producing 'nan'.
Related errors
- FLUX 3 supports at most {_FLUX3_MAX_IMAGES} {field_name}, go
- Give one time per keyframe image: got {len(parts)} time(s) f
- Keyframe times must be numbers in seconds, comma-separated;
- Keyframe times must increase; got {times}.
- Keyframe times cannot be negative; got {times[0]}.
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/a90e2ff12c26ada5.
Report an issue: GitHub.