{"record":{"id":"f3393dc4da8c6ddd","repo":"calesthio/OpenMontage","slug":"tokenhub-task-task-id-did-not-finish-within-tim","errorCode":null,"errorMessage":"TokenHub task {task_id} did not finish within {timeout_seconds}s","messagePattern":"TokenHub task (.+?) did not finish within (.+?)s","errorType":"exception","errorClass":"TimeoutError","httpStatus":null,"severity":"error","filePath":"tools/graphics/hunyuan_image.py","lineNumber":521,"sourceCode":"                    raise RuntimeError(\n                        f\"TokenHub task {task_id} completed but no data[].url: {data}\"\n                    )\n                return urls\n\n            if status == \"failed\":\n                error_info = data.get(\"error\") or {}\n                error_msg = error_info.get(\"message\", \"unknown error\")\n                raise RuntimeError(\n                    f\"TokenHub task {task_id} failed: {error_msg}\"\n                )\n\n            # queued / running / in_progress — continue polling\n            if status not in (\"queued\", \"running\", \"in_progress\"):\n                raise RuntimeError(\n                    f\"TokenHub task {task_id} returned unknown status: {status}\"\n                )\n\n        raise TimeoutError(\n            f\"TokenHub task {task_id} did not finish within {timeout_seconds}s\"\n        )\n\n    # ------------------------------------------------------------------\n    # Error handling helpers\n    # ------------------------------------------------------------------\n\n    @staticmethod\n    def _safe_error(exc: Exception) -> str:\n        \"\"\"Redact secret values from exception messages.\"\"\"\n        msg = str(exc)\n        for var in (\"TENCENT_TOKENHUB_API_KEY\",):\n            val = os.environ.get(var, \"\")\n            if val:\n                msg = msg.replace(val, \"[redacted]\")\n        return msg\n\n    @staticmethod","sourceCodeStart":503,"sourceCodeEnd":539,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/graphics/hunyuan_image.py#L503-L539","documentation":"TimeoutError raised when the TokenHub task does not reach a terminal status (completed/failed) within the caller-supplied timeout_seconds window. The poller loops with poll_interval until the deadline; non-terminal statuses simply continue, so a stuck or slow task eventually exhausts the budget.","triggerScenarios":"Long Hunyuan generations (high resolution, many images) exceeding a tight timeout_seconds; TokenHub queue congestion; a task wedged in 'running' due to an upstream incident.","commonSituations":"Default timeout too short for batch-size=n requests; peak-hour queue backlog; timeout value copied from a faster model's invocation.","solutions":["Increase the timeout_seconds input for the call (e.g. 600+ for multi-image requests)","Check TokenHub status/announcements for congestion before long retry loops","Reduce requested image count or resolution so the task finishes faster","Note the task may still complete server-side; polling the same task_id again (if you captured it) can recover the result without re-spending"],"exampleFix":"// before\ninputs = {\"prompt\": \"...\", \"timeout_seconds\": 120}\n// after\ninputs = {\"prompt\": \"...\", \"timeout_seconds\": 600, \"poll_interval\": 3}","handlingStrategy":"retry","validationCode":"inputs[\"timeout_seconds\"] = max(int(inputs.get(\"timeout_seconds\", 0)), 600)","typeGuard":null,"tryCatchPattern":"try:\n    urls = client._poll_task(task_id, timeout_seconds=600, ...)\nexcept TimeoutError:\n    # task may still finish server-side; re-poll the same task_id if you captured it","preventionTips":["Scale timeout_seconds with requested image count and resolution","Persist task_id at submit time so timeouts are recoverable, not lossy","Avoid tight poll_interval values that add API load without speeding the task"],"tags":["hunyuan","tokenhub","timeout","polling"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}