calesthio/OpenMontage · error · ValueError

get requires 'clip_id'

Error message

get requires 'clip_id'

What it means

Raised by _op_get when inputs['clip_id'] is missing or falsy. This is the single-record lookup operation; unlike the others it does not validate existence — a nonexistent but present id returns {'found': False} rather than raising.

Source

Thrown at tools/video/clip_search.py:351

        raise ValueError("diversify requires 'candidate_ids'")

    kept = corp.diversify(
        candidate_ids=list(candidate_ids),
        n=int(inputs.get("n", 5)),
        diversity=float(inputs.get("diversity", 0.5)),
    )
    return {
        "input_count": len(candidate_ids),
        "kept_count": len(kept),
        "kept_ids": kept,
    }


def _op_get(corp, inputs: dict[str, Any]) -> dict[str, Any]:
    """Look up one clip_id and return its full record."""
    clip_id = inputs.get("clip_id")
    if not clip_id:
        raise ValueError("get requires 'clip_id'")

    rec = corp.get(clip_id)
    if rec is None:
        return {"clip_id": clip_id, "found": False, "record": None}
    return {"clip_id": clip_id, "found": True, "record": asdict(rec)}

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Pass clip_id explicitly, e.g. the record's id from a prior rank/find_similar result
  2. Check the 'found' flag in the response rather than expecting an error for unknown ids
  3. Standardize your pipeline on one key name and map at the boundary

Example fix

# before
result = clip_search.run(inputs={'operation':'get'})

# after
result = clip_search.run(inputs={'operation':'get','clip_id':'clip_000123'})
Defensive patterns

Strategy: validation

Validate before calling

clip_id = inputs.get('clip_id')
if not clip_id:
    raise ValueError('clip_id required for get')
inputs['clip_id'] = clip_id

Type guard

def valid_get_inputs(inputs: dict) -> bool:
    return bool(inputs.get('clip_id'))

Try / catch

try:
    result = clip_search.run(inputs=inputs)
except ValueError as e:
    if "get requires" in str(e):
        raise SystemExit('pass a clip_id to look up') from e
    raise

Prevention

When it happens

Trigger: Calling operation='get' with no arguments; passing the id under 'seed_clip_id' or 'id'; an id variable that is None after a failed extraction from another result.

Common situations: Key-name drift when chaining ops (rank uses query_text, find_similar uses seed_clip_id, get uses clip_id); agent tool calls omitting the argument; destructuring a record and grabbing a wrong field name.

Related errors


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