Comfy-Org/ComfyUI · error · ValueError

kling-video-o1 only supports durations of 5 or 10 seconds.

Error message

kling-video-o1 only supports durations of 5 or 10 seconds.

What it means

Client-side model-capability guard in the Kling text-to-video node: kling-video-o1 only accepts durations of exactly 5 or 10 seconds. Any other value (including 15, 20, or fractional settings) is rejected before any API call. The combo of model_name == 'kling-video-o1' and duration not in (5, 10) triggers it.

Source

Thrown at comfy_api_nodes/nodes_kling.py:701

            ),
        )

    @classmethod
    async def execute(
        cls,
        model_name: str,
        prompt: str,
        aspect_ratio: str,
        duration: int,
        resolution: str = "1080p",
        storyboards: dict | None = None,
        generate_audio: bool = False,
        seed: int = 0,
    ) -> IO.NodeOutput:
        _ = seed
        if model_name == "kling-video-o1":
            if duration not in (5, 10):
                raise ValueError("kling-video-o1 only supports durations of 5 or 10 seconds.")
            if generate_audio:
                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.")
        validate_string(prompt, strip_whitespace=True, min_length=0 if stories_enabled else 1, max_length=2500)

        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"]

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Set duration to 5 or 10 when using kling-video-o1
  2. Update saved workflows that pair o1 with other durations
  3. If you need longer videos, switch to a model that supports them, or chain two o1 generations

Example fix

// before
model_name = "kling-video-o1"; duration = 15

// after
model_name = "kling-video-o1"; duration = 10
Defensive patterns

Strategy: validation

Validate before calling

def o1_t2v_ok(model_name: str, duration: int) -> bool:
    return model_name != "kling-video-o1" or duration in (5, 10)

assert o1_t2v_ok(model_name, duration)

Type guard

def is_valid_o1_duration(model_name: str, duration: int) -> bool:
    if model_name != "kling-video-o1":
        return True
    return duration in (5, 10)

Try / catch

try:
    out = await kling_t2v_node(model_name=model, duration=duration, ...)
except ValueError as e:
    if "only supports durations" in str(e):
        out = await kling_t2v_node(model_name=model, duration=10, ...)
    else:
        raise

Prevention

When it happens

Trigger: Selecting kling-video-o1 with duration 3, 15, or any value other than 5/10 in a text-to-video workflow; workflows saved with older defaults; programmatic runs passing duration=15.

Common situations: Switching the model dropdown from kling-v2.x (which allows 5/10 but sometimes 15+ via storyboard totals) to o1 without updating duration; old workflow JSONs carrying incompatible duration values.

Related errors


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