{"record":{"id":"5933df7b6d5a263b","repo":"calesthio/OpenMontage","slug":"seedream-task-timed-out-after-300-s","errorCode":null,"errorMessage":"Seedream task timed out after {300}s","messagePattern":"Seedream task timed out after (.+?)s","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"tools/graphics/seedream_image.py","lineNumber":222,"sourceCode":"                    status_url,\n                    headers=headers,\n                    timeout=30,\n                )\n                status_resp.raise_for_status()\n                status_data = status_resp.json()\n                status = status_data.get(\"status\")\n\n                if status == \"COMPLETED\":\n                    break\n                elif status in (\"FAILED\", \"CANCELLED\"):\n                    error_msg = status_data.get(\"error\", \"Unknown error\")\n                    raise RuntimeError(f\"Seedream task {status}: {error_msg}\")\n\n                time.sleep(10)\n                elapsed += 10\n\n            if elapsed >= 300:\n                raise RuntimeError(\n                    f\"Seedream task timed out after {300}s\"\n                )\n\n            result_resp = requests.get(\n                f\"https://queue.fal.run/bytedance/seedream/requests/\"\n                f\"{request_id}\",\n                headers=headers,\n                timeout=30,\n            )\n            result_resp.raise_for_status()\n            result_data = result_resp.json()\n\n            images = result_data.get(\"images\", [])\n            if not images:\n                raise RuntimeError(\"Seedream completed but no images returned\")\n\n            ext = inputs.get(\"output_format\", \"jpeg\")\n            expected_paths = self._output_paths(","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/graphics/seedream_image.py#L204-L240","documentation":"Raised when the Seedream status loop accumulates 300 seconds (polling every 10s) without reaching COMPLETED, FAILED, or CANCELLED. The task stays IN_PROGRESS/QUEUED past the hard-coded 5-minute budget, so the tool gives up client-side even though the task may still finish server-side.","triggerScenarios":"High queue load on fal.run; very large image counts or max-resolution requests; polling started right after a cold model start. Note the budget is fixed (300s), not derived from a timeout input.","commonSituations":"Peak-hour queues; batch jobs submitting many Seedream tasks at once; long generation settings (multiple images at 2K+).","solutions":["Retry — the task often completes server-side; check the fal dashboard by request_id before resubmitting to avoid paying twice","Reduce work per request (fewer images, lower resolution)","Raise the 300s budget in seedream_image.py if long queues are normal for you","Stagger batch submissions to avoid self-inflicted queueing"],"exampleFix":"// before\nwhile elapsed < 300:\n// after\nbudget = float(inputs.get(\"timeout\", 300))\nwhile elapsed < budget:","handlingStrategy":"retry","validationCode":"null","typeGuard":null,"tryCatchPattern":"try:\n    return seedream_run(inputs)\nexcept RuntimeError as e:\n    if \"timed out\" in str(e):\n        # task may still finish server-side: check status by request_id\n        # before resubmitting (avoid double billing)\n        return check_or_resubmit_last_request()","preventionTips":["Raise the 300s budget or expose it as an input for long jobs","Reduce images/resolution per request to cut queue+render time","Stagger batches; poll the fal dashboard by request_id before resubmitting"],"tags":["seedream","fal","timeout","polling","queue"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}