calesthio/OpenMontage · error · ValueError

Gemini Omni developer reference_to_video requires exactly on

Error message

Gemini Omni developer reference_to_video requires exactly one video_clip

What it means

Raised in _build_payload for media_style=='gemini_video_clips' when the video_clips list does not contain exactly one clip. The Gemini Omni developer reference route accepts a single video clip; if video_clips is absent but video_url/reference_video_url is set, one clip is auto-synthesized with start=0 and ends=min(duration,10), otherwise len(clips)!=1 fails.

Source

Thrown at tools/video/atlas_video.py:282

        elif style == "h3_refers":
            refers = list(inputs.get("refers") or [])
            if not refers:
                refers = [
                    *({"url": value, "type": "image"} for value in images),
                    *({"url": value, "type": "video"} for value in videos),
                    *({"url": value, "type": "audio"} for value in audios),
                ]
                if image:
                    refers.insert(0, {"url": image, "type": "image"})
            if not refers or not any(item.get("type") in {"image", "video"} for item in refers):
                raise ValueError("MiniMax H3 reference_to_video requires at least one image or video in refers")
            payload["refers"] = refers
        elif style == "gemini_video_clips":
            clips = list(inputs.get("video_clips") or [])
            if not clips and video:
                clips = [{"url": video, "start": 0, "ends": min(int(inputs.get("duration", 10)), 10)}]
            if len(clips) != 1:
                raise ValueError("Gemini Omni developer reference_to_video requires exactly one video_clip")
            payload["video_clips"] = clips
            if images:
                payload["images"] = images
        elif style == "gemini_video_edit":
            if not video:
                raise ValueError("video_edit requires video_url, video_path, or reference_video_path")
            payload["video"] = video
            if images:
                if len(images) > spec["media_limits"].get("images", 10):
                    raise ValueError("Gemini Omni video_edit accepts at most 10 reference images")
                payload["images"] = images

        extra = inputs.get("extra_params")
        if isinstance(extra, dict):
            payload.update(extra)
        return payload

    @staticmethod

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Pass exactly one clip dict in video_clips (with url/start/ends fields per the route's schema)
  2. Or simply pass video_url (or reference_video_url) and let the tool synthesize the single clip with start=0, ends=min(duration,10)
  3. Split multi-clip edits into sequential single-clip calls

Example fix

# before
inputs = {'model':'google/gemini-omni-dev','operation':'reference_to_video','video_clips':clip_a_and_b}

# after
inputs = {'model':'google/gemini-omni-dev','operation':'reference_to_video','video_clips':[{'url':clip_a['url'],'start':0,'ends':10}]}
Defensive patterns

Strategy: validation

Validate before calling

clips = list(inputs.get('video_clips') or [])
if not clips and (inputs.get('video_url') or inputs.get('reference_video_url')):
    clips = [{'url': inputs.get('video_url') or inputs['reference_video_url'],
              'start': 0, 'ends': min(int(inputs.get('duration', 10)), 10)}]
if len(clips) != 1:
    raise ValueError('exactly one video_clip required')
inputs['video_clips'] = clips

Type guard

def single_clip(inputs: dict) -> bool:
    clips = inputs.get('video_clips')
    return (isinstance(clips, list) and len(clips) == 1 and
            bool(clips[0].get('url')))

Try / catch

try:
    result = atlas_video.run(inputs=inputs)
except ValueError as e:
    if 'exactly one video_clip' in str(e):
        raise SystemExit('send one clip, or just video_url and let it default') from e
    raise

Prevention

When it happens

Trigger: Passing two or more entries in video_clips; passing zero clips and no video_url; passing video_clips with a single malformed/None entry filtered to zero by list().

Common situations: Porting a multi-clip editing workflow to a single-clip endpoint; forgetting video_url so no default clip is created; a wrapper packaging clips as a dict instead of a list.

Related errors


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