calesthio/OpenMontage · error · ValueError

reference_to_video accepts at most {max_images} reference im

Error message

reference_to_video accepts at most {max_images} reference images

What it means

Raised in reference_to_video mode when the total number of image references (reference_image_urls + reference_image_paths + singular url/path keys) exceeds the model limit: 30 for variant 2.5, 9 otherwise. The builder enforces Ark's multimodal reference cap client-side.

Source

Thrown at tools/video/seedance_ark.py:773

                if value
            ]
            if len(end_refs) > 1:
                raise ValueError("provide only one of end_image_url/end_image_path")
            if end_refs:
                content.append(self._image_content(end_refs[0], role="last_frame"))
        else:
            image_refs = list(inputs.get("reference_image_urls") or [])
            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"
                    )

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Trim reference_image_urls/paths to at most 9 (or 30 with model_variant='2.5')
  2. Set model_variant='2.5' when you genuinely need 10-30 image refs
  3. Composite multiple references into fewer images before sending

Example fix

# before
inputs = {"operation": "reference_to_video", "reference_image_urls": storyboard_40}

# after
storyboard = storyboard_40[:30]
inputs = {"operation": "reference_to_video", "model_variant": "2.5",
          "reference_image_urls": storyboard}
Defensive patterns

Strategy: validation

Validate before calling

def image_ref_list(inputs):
    refs = list(inputs.get("reference_image_urls") or [])
    refs += list(inputs.get("reference_image_paths") or [])
    if inputs.get("reference_image_url"): refs.append(inputs["reference_image_url"])
    if inputs.get("reference_image_path"): refs.append(inputs["reference_image_path"])
    return refs

variant = str(inputs.get("model_variant", "standard")).lower()
assert len(image_ref_list(inputs)) <= (30 if variant == "2.5" else 9)

Type guard

def within_image_limit(inputs: dict) -> bool:
    return len(image_ref_list(inputs)) <= (30 if str(inputs.get("model_variant", "standard")).lower() == "2.5" else 9)

Prevention

When it happens

Trigger: operation='reference_to_video' with more than 9 image refs on standard/fast/mini, or more than 30 on model_variant='2.5'.

Common situations: Feeding an entire storyboard or sprite sheet folder as individual refs; not realizing the cap depends on the model variant; mixing singular and plural image keys so the count silently grows.

Related errors


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