calesthio/OpenMontage · error · RuntimeError

Gemini Omni video generation failed during processing

Error message

Gemini Omni video generation failed during processing

What it means

Raised when the generated output file on the Google Files API transitions to state=FAILED. After submitting a Gemini Omni generation, the tool polls GET {BASE_URL}/files/{file_id} until the output becomes ACTIVE; FAILED means the generation job itself crashed or was rejected server-side after submission succeeded.

Source

Thrown at tools/video/gemini_omni_video.py:328

        idx = path.rfind(marker)
        tail = path[idx + len(marker):] if idx != -1 else path.split("/")[-1]
        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,

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Rewrite the prompt to remove potentially policy-violating content (likenesses, explicit or violent descriptions) and retry.
  2. Swap out the reference image/video with a neutral one to test whether the reference triggers the failure.
  3. Retry once — internal generation failures are sometimes transient.
  4. Submit a simpler request (text-only, shorter duration) to confirm the account/key itself is healthy.
  5. Check Google Cloud service status for Gemini API incidents.
Defensive patterns

Strategy: try-catch

Try / catch

try:
    result = gemini_omni_video(inputs)
except RuntimeError as e:
    if "failed during processing" in str(e).lower():
        # provider-side render failure: adjust content or refs, do not blind-retry
        log_safety_review(prompt=inputs.get("prompt"), refs=inputs)
        raise GenerationRejected("rewrite prompt or swap references") from e
    raise

Prevention

When it happens

Trigger: Polling the output file's state returns 'FAILED'. Happens when the generation request is accepted but rendering fails: policy-violating prompt or reference content, internal model errors, or corrupted input references (e.g. a video that finished Files processing but is unusable for generation).

Common situations: Prompts with policy-triggering content (real-person likeness, violence, etc.); reference images/videos flagged by safety filters; Google-side capacity or internal errors; malformed multi-reference bindings the model cannot compose.

Related errors


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