{"record":{"id":"28dc0998d0bd5913","repo":"Comfy-Org/ComfyUI","slug":"duration-is-only-supported-for-5-or-10-seconds-if","errorCode":null,"errorMessage":"Duration is only supported for 5 or 10 seconds if there is no end frame or reference images.","messagePattern":"Duration is only supported for 5 or 10 seconds if there is no end frame or reference images\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_kling.py","lineNumber":889,"sourceCode":"                raise ValueError(\"kling-video-o1 does not support audio generation.\")\n            if resolution == \"4k\":\n                raise ValueError(\"kling-video-o1 does not support 4k resolution.\")\n        stories_enabled = storyboards is not None and storyboards[\"storyboards\"] != \"disabled\"\n        if stories_enabled and model_name == \"kling-video-o1\":\n            raise ValueError(\"kling-video-o1 does not support storyboards.\")\n        prompt = normalize_omni_prompt_references(prompt)\n        validate_string(prompt, strip_whitespace=True, min_length=0 if stories_enabled else 1, max_length=2500)\n        if end_frame is not None and reference_images is not None:\n            raise ValueError(\"The 'end_frame' input cannot be used simultaneously with 'reference_images'.\")\n        if end_frame is not None and stories_enabled:\n            raise ValueError(\"The 'end_frame' input cannot be used simultaneously with storyboards.\")\n        if (\n            model_name == \"kling-video-o1\"\n            and duration not in (5, 10)\n            and end_frame is None\n            and reference_images is None\n        ):\n            raise ValueError(\n                \"Duration is only supported for 5 or 10 seconds if there is no end frame or reference images.\"\n            )\n\n        multi_shot = None\n        multi_prompt_list = None\n        if stories_enabled:\n            count = int(storyboards[\"storyboards\"].split()[0])\n            multi_shot = True\n            multi_prompt_list = []\n            for i in range(1, count + 1):\n                sb_prompt = storyboards[f\"storyboard_{i}_prompt\"]\n                sb_duration = storyboards[f\"storyboard_{i}_duration\"]\n                validate_string(sb_prompt, field_name=f\"storyboard_{i}_prompt\", min_length=1, max_length=512)\n                multi_prompt_list.append(\n                    MultiPromptEntry(\n                        index=i,\n                        prompt=sb_prompt,\n                        duration=str(sb_duration),","sourceCodeStart":871,"sourceCodeEnd":907,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_kling.py#L871-L907","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before\nmodel_name = \"kling-video-o1\"\nduration = 8\nend_frame = None\nreference_images = None\n\n// after\nmodel_name = \"kling-video-o1\"\nduration = 10\nend_frame = None\nreference_images = None","handlingStrategy":"validation","validationCode":"def o1_duration_ok(model_name: str, duration: int, end_frame, reference_images) -> bool:\n    if model_name != \"kling-video-o1\":\n        return True\n    if end_frame is not None or reference_images is not None:\n        return True\n    return duration in (5, 10)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["kling","video","duration","model-validation","api-nodes"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}