calesthio/OpenMontage · error · ValueError
priority must be between 0 and 9
Error message
priority must be between 0 and 9
What it means
Raised by SeedanceArkVideo._validate_optional_parameters when the optional 'priority' input falls outside the integer range [0, 9]. The Ark API accepts priority as a small integer where higher values mean earlier scheduling; anything negative or above 9 is rejected before the HTTP request is ever sent. This is a fail-fast client-side guard, so no network call or tokens are consumed.
Source
Thrown at tools/video/seedance_ark.py:1216
value = str(ref)
if not value.startswith(("https://", "http://", "asset://")):
raise ValueError(
f"{label} must be a public/signed URL or asset:// ID; "
"Ark does not document video Base64 or local paths"
)
def _validate_optional_parameters(self, payload: dict[str, Any]) -> None:
callback = payload.get("callback_url")
if callback is not None and not str(callback).startswith(
("https://", "http://")
):
raise ValueError("callback_url must be an http(s) URL")
expires = payload.get("execution_expires_after")
if expires is not None and not 3600 <= int(expires) <= 259200:
raise ValueError("execution_expires_after must be between 3600 and 259200")
priority = payload.get("priority")
if priority is not None and not 0 <= int(priority) <= 9:
raise ValueError("priority must be between 0 and 9")
safety = payload.get("safety_identifier")
if safety is not None and len(str(safety)) > 64:
raise ValueError("safety_identifier must be at most 64 characters")
def _validate_request_size(self, payload: dict[str, Any]) -> None:
# Base64 dominates request size; summing encoded media is a conservative
# lower-cost check that avoids building a second complete JSON string.
encoded_bytes = 0
for item in payload["content"]:
media = (
item.get("image_url")
or item.get("audio_url")
or item.get("video_url")
or {}
)
url = str(media.get("url", ""))
if url.startswith("data:"):
encoded_bytes += len(url.encode("ascii"))View on GitHub (pinned to 95e1c3d0ab)
Solutions
- Set priority to an integer between 0 and 9 (9 is highest).
- Omit the priority key entirely if scheduling priority is not needed — the validator skips None.
- If the value comes from user config, clamp it: max(0, min(9, int(value))) before passing it in.
Example fix
# before
inputs = {"prompt": "...", "priority": 10}
# after
inputs = {"prompt": "...", "priority": 9} Defensive patterns
Strategy: validation
Validate before calling
priority = inputs.get("priority")
if priority is not None and not (isinstance(int(priority), int) and 0 <= int(priority) <= 9):
inputs["priority"] = max(0, min(9, int(priority))) Type guard
def is_valid_ark_priority(v) -> bool:
try:
return v is None or 0 <= int(v) <= 9
except (TypeError, ValueError):
return False Try / catch
try:
result = tool.run(inputs)
except ValueError as e:
if "priority" in str(e):
inputs["priority"] = 5 # sane default, retry
result = tool.run(inputs)
else:
raise Prevention
- Keep provider-specific option dicts in one place per tool instead of sharing a generic options bag.
- Clamp user-supplied priority to [0,9] at your config boundary.
When it happens
Trigger: Calling the seedance_ark video tool with inputs containing priority=10, priority=-1, or a numeric string like '12'. Also triggered by strings that int() coerces out of range (e.g. '9.5' raises ValueError inside int() before the range check message is produced — that surfaces a different message, but values like '11' hit this one).
Common situations: Agents copying priority values from other provider schemas (some APIs use 0-100 scales), user config files carrying priority from a different tool, or assuming priority 10 = maximum.
Related errors
- safety_identifier must be at most 64 characters
- text_to_video does not accept reference media; use image_to_
- image_to_video requires exactly one reference image
- provide only one of end_image_url/end_image_path
- reference_to_video accepts at most {max_images} reference im
AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15).
Data as JSON: /api/errors/76ee9fc8cfdde5b1.
Report an issue: GitHub.