Comfy-Org/ComfyUI · error · ValueError
Total storyboard duration ({total_storyboard_duration}s) mus
Error message
Total storyboard duration ({total_storyboard_duration}s) must equal the global duration ({duration}s). What it means
Client-side consistency check after building the multi-prompt storyboard list: the sum of all per-storyboard durations must exactly equal the node's global duration parameter. Any mismatch (e.g. 3+3+5 storyboards vs duration=10) raises with both totals in the message. Prevents sending Kling a multi_prompt list whose durations disagree with the top-level duration.
Source
Thrown at comfy_api_nodes/nodes_kling.py:730
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),
)
)
total_storyboard_duration = sum(int(e.duration) for e in multi_prompt_list)
if total_storyboard_duration != duration:
raise ValueError(
f"Total storyboard duration ({total_storyboard_duration}s) "
f"must equal the global duration ({duration}s)."
)
if resolution == "4k":
mode = "4k"
elif resolution == "1080p":
mode = "pro"
else:
mode = "std"
response = await sync_op(
cls,
ApiEndpoint(path="/proxy/kling/v1/videos/omni-video", method="POST"),
response_model=TaskStatusResponse,
data=OmniProText2VideoRequest(
model_name=model_name,
prompt=prompt,
aspect_ratio=aspect_ratio,View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Make the storyboard slot durations sum exactly to the global duration (message shows both numbers)
- Adjust the global duration input to match the sum, or trim a slot
- Compute the global duration programmatically from the slots when driving the node via API
Example fix
// before
duration = 10
storyboards = {"storyboards": "3 shots", "storyboard_1_duration": 5, "storyboard_2_duration": 5, "storyboard_3_duration": 5} # sum 15 != 10
// after
duration = 15 # equals 5+5+5 Defensive patterns
Strategy: validation
Validate before calling
def storyboard_total_valid(storyboards: dict, duration: int, count: int) -> bool:
total = sum(int(storyboards[f"storyboard_{i}_duration"]) for i in range(1, count + 1))
return total == duration
assert storyboard_total_valid(storyboards, duration, count) Type guard
def durations_consistent(storyboards: dict, duration: int) -> bool:
keys = [k for k in storyboards if k.endswith("_duration")]
return sum(int(storyboards[k]) for k in keys) == duration Try / catch
try:
out = await kling_t2v_node(model_name=model, duration=duration, storyboards=storyboards, ...)
except ValueError as e:
if "must equal the global duration" in str(e):
fixed = sum(int(storyboards[k]) for k in storyboards if k.endswith("_duration"))
out = await kling_t2v_node(model_name=model, duration=fixed, storyboards=storyboards, ...)
else:
raise Prevention
- Derive the global duration from the slot sum when driving the node programmatically
- After editing any storyboard duration, re-total before running
- Use whole-second slot durations — the check compares int values exactly
When it happens
Trigger: Editing storyboard durations without re-totaling the global duration input; adding/removing a storyboard slot; unit confusion (seconds vs. frames) in programmatic runs.
Common situations: Iterative storyboard editing; copied workflows with per-slot durations that don't match the copied global duration; fractional durations truncated by int().
Related errors
- kling-video-o1 only supports durations of 5 or 10 seconds.
- kling-video-o1 does not support storyboards.
- Positive prompt is empty
- Positive prompt is too long: {len(prompt)} characters
- Negative prompt is too long: {len(negative_prompt)} characte
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/e64381fb954c007a.
Report an issue: GitHub.