Comfy-Org/ComfyUI · error · ValueError
Duration is only supported for 5 or 10 seconds if there is n
Error message
Duration is only supported for 5 or 10 seconds if there is no end frame or reference images.
What it means
Raised by OmniProFirstLastFrameNode.execute for model 'kling-video-o1' when duration is not 5 or 10 and neither end_frame nor reference_images is supplied. The o1 endpoint only accepts fixed 5s/10s durations for plain text(+first-frame) jobs; when an end frame or references are present the duration is implied by the media instead.
Source
Thrown at comfy_api_nodes/nodes_kling.py:889
raise ValueError("kling-video-o1 does not support audio generation.")
if resolution == "4k":
raise ValueError("kling-video-o1 does not support 4k resolution.")
stories_enabled = storyboards is not None and storyboards["storyboards"] != "disabled"
if stories_enabled and model_name == "kling-video-o1":
raise ValueError("kling-video-o1 does not support storyboards.")
prompt = normalize_omni_prompt_references(prompt)
validate_string(prompt, strip_whitespace=True, min_length=0 if stories_enabled else 1, max_length=2500)
if end_frame is not None and reference_images is not None:
raise ValueError("The 'end_frame' input cannot be used simultaneously with 'reference_images'.")
if end_frame is not None and stories_enabled:
raise ValueError("The 'end_frame' input cannot be used simultaneously with storyboards.")
if (
model_name == "kling-video-o1"
and duration not in (5, 10)
and end_frame is None
and reference_images is None
):
raise ValueError(
"Duration is only supported for 5 or 10 seconds if there is no end frame or reference images."
)
multi_shot = None
multi_prompt_list = None
if stories_enabled:
count = int(storyboards["storyboards"].split()[0])
multi_shot = True
multi_prompt_list = []
for i in range(1, count + 1):
sb_prompt = storyboards[f"storyboard_{i}_prompt"]
sb_duration = storyboards[f"storyboard_{i}_duration"]
validate_string(sb_prompt, field_name=f"storyboard_{i}_prompt", min_length=1, max_length=512)
multi_prompt_list.append(
MultiPromptEntry(
index=i,
prompt=sb_prompt,
duration=str(sb_duration),View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Set duration to exactly 5 or 10 when using kling-video-o1 without end frame or reference images
- Connect an end_frame or reference_images only if you actually need them; duration then no longer needs to be 5/10 in this branch
- Switch to a non-o1 omni model if you need arbitrary durations
Example fix
// before model_name = "kling-video-o1" duration = 8 end_frame = None reference_images = None // after model_name = "kling-video-o1" duration = 10 end_frame = None reference_images = None
Defensive patterns
Strategy: validation
Validate before calling
def o1_duration_ok(model_name: str, duration: int, end_frame, reference_images) -> bool:
if model_name != "kling-video-o1":
return True
if end_frame is not None or reference_images is not None:
return True
return duration in (5, 10) Prevention
- Pin the duration widget to 5/10 whenever the model selector is kling-video-o1
- Don't share one duration widget across node types with different duration rules
When it happens
Trigger: model_name='kling-video-o1', duration set to any value other than 5 or 10, with end_frame=None and reference_images=None. Note duration>10 is also separately rejected (error 486's sibling check in this class).
Common situations: A shared widget feeds duration (e.g. 3, 8, or 15) from another Kling node type into the o1 path; the user assumes o1 supports the same flexible duration set as kling-video-v2.
Related errors
- Reference video {i} is too short: {dur:.1f}s. Minimum durati
- Total reference video duration is {total_video_duration:.1f}
- The 'end_frame' input cannot be used simultaneously with 're
- The 'end_frame' input cannot be used simultaneously with sto
- The maximum number of reference images allowed is 6.
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/28dc0998d0bd5913.
Report an issue: GitHub.