calesthio/OpenMontage · error · ValueError

reference_to_video accepts at most {max_videos} reference vi

Error message

reference_to_video accepts at most {max_videos} reference videos

What it means

Raised in reference_to_video mode when the count of video references (reference_video_urls list plus singular reference_video_url) exceeds the model limit: 10 for variant 2.5, 3 otherwise. Note reference_video_path is rejected earlier for Ark, so only URL-based refs count here.

Source

Thrown at tools/video/seedance_ark.py:781

            image_refs.extend(inputs.get("reference_image_paths") or [])
            if inputs.get("reference_image_url"):
                image_refs.append(inputs["reference_image_url"])
            if inputs.get("reference_image_path"):
                image_refs.append(inputs["reference_image_path"])
            max_images = 30 if variant == "2.5" else 9
            max_videos = 10 if variant == "2.5" else 3
            max_audios = 10 if variant == "2.5" else 3
            max_reference_seconds = 30 if variant == "2.5" else 15
            if len(image_refs) > max_images:
                raise ValueError(
                    f"reference_to_video accepts at most {max_images} reference images"
                )

            video_refs = list(inputs.get("reference_video_urls") or [])
            if inputs.get("reference_video_url"):
                video_refs.append(inputs["reference_video_url"])
            if len(video_refs) > max_videos:
                raise ValueError(
                    f"reference_to_video accepts at most {max_videos} reference videos"
                )
            self._validate_remote_refs(video_refs, "reference video")
            video_durations = list(inputs.get("reference_video_durations") or [])
            if video_durations:
                if len(video_durations) != len(video_refs):
                    raise ValueError(
                        "reference_video_durations must match the number of "
                        "reference videos"
                    )
                if any(
                    float(value) < 2 or float(value) > max_reference_seconds
                    for value in video_durations
                ):
                    raise ValueError(
                        f"each reference video duration must be 2 to {max_reference_seconds} seconds"
                    )
                if (

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Reduce reference_video_urls to at most 3 (or 10 with model_variant='2.5')
  2. Concatenate clips into fewer reference videos with ffmpeg first
  3. Switch to model_variant='2.5' when the larger reference set is required

Example fix

# before
inputs = {"operation": "reference_to_video", "reference_video_urls": clips[:6]}

# after
inputs = {"operation": "reference_to_video", "model_variant": "2.5",
          "reference_video_urls": clips[:6]}
Defensive patterns

Strategy: validation

Validate before calling

variant = str(inputs.get("model_variant", "standard")).lower()
max_videos = 10 if variant == "2.5" else 3
video_refs = list(inputs.get("reference_video_urls") or [])
if inputs.get("reference_video_url"): video_refs.append(inputs["reference_video_url"])
assert len(video_refs) <= max_videos

Type guard

def within_video_limit(inputs: dict) -> bool:
    v = list(inputs.get("reference_video_urls") or [])
    if inputs.get("reference_video_url"): v.append(inputs["reference_video_url"])
    return len(v) <= (10 if str(inputs.get("model_variant", "standard")).lower() == "2.5" else 3)

Prevention

When it happens

Trigger: operation='reference_to_video' with more than 3 video URL refs (or more than 10 with model_variant='2.5').

Common situations: Passing a clip playlist as multiple reference videos; assuming the 2.5 limits apply to every variant.

Related errors


AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15). Data as JSON: /api/errors/2ed718e9bb993705. Report an issue: GitHub.