calesthio/OpenMontage · error · ValueError

reference_to_video requires at least one image or video

Error message

reference_to_video requires at least one image or video

What it means

Raised in reference_to_video mode when neither image nor video references are present. The operation is defined by visual conditioning, so an empty reference set makes the request meaningless and is rejected before the API call (note this branch is also the default for any operation other than text_to_video/image_to_video).

Source

Thrown at tools/video/seedance_ark.py:861

                for ref in audio_refs
                if (
                    duration := self._local_or_data_audio_duration(
                        str(ref), max_seconds=max_reference_seconds
                    )
                )
                is not None
            ]
            if sum(local_audio_durations) > max_reference_seconds:
                raise ValueError(
                    "all local reference audio clips together must be at "
                    f"most {max_reference_seconds} seconds"
                )
            if audio_refs and not (image_refs or video_refs):
                raise ValueError(
                    "reference audio requires at least one reference image or video"
                )
            if not (image_refs or video_refs):
                raise ValueError(
                    "reference_to_video requires at least one image or video"
                )

            content.extend(
                self._image_content(ref, role="reference_image") for ref in image_refs
            )
            content.extend(
                {
                    "type": "video_url",
                    "video_url": {"url": str(ref)},
                    "role": "reference_video",
                }
                for ref in video_refs
            )
            content.extend(
                self._audio_content(ref, role="reference_audio") for ref in audio_refs
            )

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Provide at least one image or video reference
  2. Use text_to_video when no references are available
  3. Check the operation string for typos, since unknown values fall into this branch

Example fix

# before
inputs = {"operation": "reference_to_video", "prompt": p}

# after
inputs = {"operation": "text_to_video", "prompt": p}
Defensive patterns

Strategy: validation

Validate before calling

if not (image_ref_list(inputs) or video_ref_list(inputs)):
    if not inputs.get("prompt"):
        raise ValueError("nothing to generate from")
    inputs["operation"] = "text_to_video"  # downgrade to prompt-only

Type guard

def operation_has_required_refs(inputs: dict) -> bool:
    op = inputs.get("operation")
    if op == "reference_to_video":
        return bool(image_ref_list(inputs) or video_ref_list(inputs))
    return True

Prevention

When it happens

Trigger: operation='reference_to_video' (or an unrecognized operation string) with all reference_image_* and reference_video_* keys empty.

Common situations: Defaulting operation to reference_to_video and forgetting refs; typo'ing the operation value (e.g. 'reference2video') so it falls into this branch; refs dropped by upstream null-filtering.

Related errors


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