calesthio/OpenMontage · error · ValueError

text_to_video does not accept reference media; use image_to_

Error message

text_to_video does not accept reference media; use image_to_video or reference_to_video

What it means

Raised while building the Ark Seedance request payload when operation is 'text_to_video' but the inputs dict contains any reference media (image or video refs). The Ark text-to-video content array accepts only a text prompt; media references must go through image_to_video or reference_to_video. It fires before any network call, so no API quota is consumed.

Source

Thrown at tools/video/seedance_ark.py:740

        max_duration = 30 if variant == "2.5" else 15
        duration = self._normalize_duration(inputs.get("duration", 5), max_duration)
        prompt = str(inputs.get("prompt") or "").strip()
        content: list[dict[str, Any]] = []
        if prompt:
            content.append({"type": "text", "text": prompt})

        if inputs.get("reference_video_path"):
            raise ValueError(
                "reference_video_path is not supported by Ark; upload the "
                "video to a public/signed HTTPS URL or Ark asset first"
            )

        if operation == "text_to_video":
            if not prompt:
                raise ValueError("prompt is required for text_to_video")
            if self._has_any_media(inputs):
                raise ValueError(
                    "text_to_video does not accept reference media; use "
                    "image_to_video or reference_to_video"
                )
        elif operation == "image_to_video":
            first_refs = self._single_image_refs(inputs)
            if len(first_refs) != 1:
                raise ValueError("image_to_video requires exactly one reference image")
            content.append(self._image_content(first_refs[0], role="first_frame"))
            end_refs = [
                value
                for value in (
                    inputs.get("end_image_url"),
                    inputs.get("end_image_path"),
                )
                if value
            ]
            if len(end_refs) > 1:
                raise ValueError("provide only one of end_image_url/end_image_path")

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Switch operation to 'reference_to_video' if you want the model to condition on the media
  2. Switch operation to 'image_to_video' if you have exactly one first-frame image
  3. Strip all reference_* media keys from inputs before calling with text_to_video

Example fix

# before
inputs = {"operation": "text_to_video", "prompt": p, "reference_image_urls": [u]}

# after
inputs = {"operation": "reference_to_video", "prompt": p, "reference_image_urls": [u]}
Defensive patterns

Strategy: validation

Validate before calling

MEDIA_KEYS = ("reference_image_urls", "reference_image_paths", "reference_image_url",
                 "reference_image_path", "reference_video_urls", "reference_video_url")

def has_media(inputs):
    return any(inputs.get(k) for k in MEDIA_KEYS)

def validate_t2v(inputs):
    if inputs.get("operation") == "text_to_video" and has_media(inputs):
        raise ValueError("drop reference media or use reference_to_video")

Try / catch

try:
    payload = builder.build(inputs)
except ValueError as e:
    if "does not accept reference media" in str(e):
        inputs = {k: v for k, v in inputs.items() if k not in MEDIA_KEYS}
        payload = builder.build(inputs)
    else:
        raise

Prevention

When it happens

Trigger: Calling the tool with operation='text_to_video' plus any of reference_image_urls/paths, reference_image_url/path, reference_video_urls, or reference_video_url populated. _has_any_media() returning True for any media key triggers it.

Common situations: Copy-pasting a reference_to_video input dict and only changing the operation field; pipelines that pass a fixed template of inputs to every operation; UI forms that always submit reference fields even when empty strings are replaced by defaults.

Related errors


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