calesthio/OpenMontage · error · TimeoutError

Timed out waiting for Gemini Omni video to become ACTIVE

Error message

Timed out waiting for Gemini Omni video to become ACTIVE

What it means

Raised when the generated output file never reaches state=ACTIVE within _MAX_POLL_SECONDS. Gemini Omni video rendering is asynchronous: the tool polls the Files API for the output file and this TimeoutError fires when rendering takes longer than the internal deadline, distinct from a FAILED state (error 243) — the job may still be running.

Source

Thrown at tools/video/gemini_omni_video.py:330

        return tail.split(":", 1)[0]

    def _download_via_uri(self, requests_mod: Any, api_key: str, uri: str) -> bytes:
        """Poll a Files API entry until ACTIVE, then download its bytes."""
        file_id = self._file_id_from_uri(uri)
        headers = {"x-goog-api-key": api_key}
        deadline = time.time() + _MAX_POLL_SECONDS
        while True:
            status_resp = requests_mod.get(
                f"{_BASE_URL}/files/{file_id}", headers=headers, timeout=15
            )
            status_resp.raise_for_status()
            state = str(status_resp.json().get("state", "")).upper()
            if state == "ACTIVE":
                break
            if state == "FAILED":
                raise RuntimeError("Gemini Omni video generation failed during processing")
            if time.time() > deadline:
                raise TimeoutError("Timed out waiting for Gemini Omni video to become ACTIVE")
            time.sleep(_POLL_INTERVAL_SECONDS)

        download_resp = requests_mod.get(
            f"{_BASE_URL}/files/{file_id}:download",
            params={"alt": "media"},
            headers=headers,
            timeout=300,
        )
        download_resp.raise_for_status()
        return download_resp.content

    def execute(self, inputs: dict[str, Any]) -> ToolResult:
        api_key = self._get_api_key()
        if not api_key:
            return ToolResult(
                success=False,
                error="GEMINI_API_KEY / GOOGLE_API_KEY not set. " + self.install_instructions,
            )

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Retry the generation — if the job completed after the timeout, often a resubmission finishes faster; note the prior job may still bill.
  2. Reduce requested duration, resolution, or the number of reference assets to shorten render time.
  3. Increase _MAX_POLL_SECONDS in tools/video/gemini_omni_video.py to accommodate long renders.
  4. Stagger heavy generation jobs instead of launching many in parallel.
Defensive patterns

Strategy: retry

Try / catch

try:
    result = gemini_omni_video(inputs)
except TimeoutError as e:
    if "become ACTIVE" in str(e):
        # job may still complete server-side; retry once, avoid rapid-fire retries
        time.sleep(60)
        result = gemini_omni_video(inputs)
    else:
        raise

Prevention

When it happens

Trigger: Loop of GET {BASE_URL}/files/{file_id} keeps returning a non-terminal state (e.g. PROCESSING) until the deadline passes. Long-duration generations, high load, or large multi-reference jobs exceed the fixed deadline.

Common situations: Requesting maximum clip duration with many bound reference images/videos; peak-hour Google capacity slowdowns; a _MAX_POLL_SECONDS tuned for short clips but used with longer jobs; slow-follow-up after a retry storm.

Understand the failure class

Related errors


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