{"record":{"id":"a2046e7641609511","repo":"calesthio/OpenMontage","slug":"timed-out-waiting-for-gemini-omni-video-to-become","errorCode":null,"errorMessage":"Timed out waiting for Gemini Omni video to become ACTIVE","messagePattern":"Timed out waiting for Gemini Omni video to become ACTIVE","errorType":"exception","errorClass":"TimeoutError","httpStatus":null,"severity":"error","filePath":"tools/video/gemini_omni_video.py","lineNumber":330,"sourceCode":"        return tail.split(\":\", 1)[0]\n\n    def _download_via_uri(self, requests_mod: Any, api_key: str, uri: str) -> bytes:\n        \"\"\"Poll a Files API entry until ACTIVE, then download its bytes.\"\"\"\n        file_id = self._file_id_from_uri(uri)\n        headers = {\"x-goog-api-key\": api_key}\n        deadline = time.time() + _MAX_POLL_SECONDS\n        while True:\n            status_resp = requests_mod.get(\n                f\"{_BASE_URL}/files/{file_id}\", headers=headers, timeout=15\n            )\n            status_resp.raise_for_status()\n            state = str(status_resp.json().get(\"state\", \"\")).upper()\n            if state == \"ACTIVE\":\n                break\n            if state == \"FAILED\":\n                raise RuntimeError(\"Gemini Omni video generation failed during processing\")\n            if time.time() > deadline:\n                raise TimeoutError(\"Timed out waiting for Gemini Omni video to become ACTIVE\")\n            time.sleep(_POLL_INTERVAL_SECONDS)\n\n        download_resp = requests_mod.get(\n            f\"{_BASE_URL}/files/{file_id}:download\",\n            params={\"alt\": \"media\"},\n            headers=headers,\n            timeout=300,\n        )\n        download_resp.raise_for_status()\n        return download_resp.content\n\n    def execute(self, inputs: dict[str, Any]) -> ToolResult:\n        api_key = self._get_api_key()\n        if not api_key:\n            return ToolResult(\n                success=False,\n                error=\"GEMINI_API_KEY / GOOGLE_API_KEY not set. \" + self.install_instructions,\n            )","sourceCodeStart":312,"sourceCodeEnd":348,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/video/gemini_omni_video.py#L312-L348","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Retry the generation — if the job completed after the timeout, often a resubmission finishes faster; note the prior job may still bill.","Reduce requested duration, resolution, or the number of reference assets to shorten render time.","Increase _MAX_POLL_SECONDS in tools/video/gemini_omni_video.py to accommodate long renders.","Stagger heavy generation jobs instead of launching many in parallel."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    result = gemini_omni_video(inputs)\nexcept TimeoutError as e:\n    if \"become ACTIVE\" in str(e):\n        # job may still complete server-side; retry once, avoid rapid-fire retries\n        time.sleep(60)\n        result = gemini_omni_video(inputs)\n    else:\n        raise","preventionTips":["Request the shortest duration that meets your creative need.","Limit bound references (images+videos) per request.","Leave headroom between the tool deadline and your own orchestration timeout."],"tags":["gemini","timeout","video-generation","polling","async-jobs"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}