{"record":{"id":"1a10141745a99839","repo":"calesthio/OpenMontage","slug":"tokenhub-task-task-id-failed-error-msg-1a1014","errorCode":null,"errorMessage":"TokenHub task {task_id} failed: {error_msg}","messagePattern":"TokenHub task (.+?) failed: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"tools/video/hunyuan_cloud_video.py","lineNumber":480,"sourceCode":"            )\n            data = self._json_or_raise(resp)\n            self._check_response(data)\n\n            status = data.get(\"status\", \"\")\n\n            if status == \"completed\":\n                result_data = data.get(\"data\") or {}\n                video_url = result_data.get(\"url\")\n                if not video_url:\n                    raise RuntimeError(\n                        f\"TokenHub task {task_id} completed but no data.url: {data}\"\n                    )\n                return video_url\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","sourceCodeStart":462,"sourceCodeEnd":498,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/video/hunyuan_cloud_video.py#L462-L498","documentation":"Raised when the TokenHub poll returns status='failed'. This is the provider's explicit terminal failure: the generation job was accepted and started but errored out. The message embeds error.message from the response (defaulting to 'unknown error' when absent), so the upstream cause text comes straight from TokenHub.","triggerScenarios":"Polling a submitted Hunyuan task where the API transitions the status to 'failed' — caused by content policy rejection, invalid model/parameters accepted at submit then rejected at runtime, quota exhaustion, or internal provider errors.","commonSituations":"Prompts with policy-violating content; unsupported parameter combinations for the chosen Hunyuan model; account out of credits/quota on TokenHub; provider-side incidents; the referenced base64 image being corrupt so rendering fails.","solutions":["Read the error_msg in the exception — TokenHub usually states the reason (content, quota, param).","Fix the stated cause: soften prompt content, correct parameters, or top up the account quota.","Resubmit with the same inputs once if the message indicates an internal/transient error.","Test with a minimal text_to_video request to confirm the account and key are healthy."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    result = hunyuan_cloud_video(inputs)\nexcept RuntimeError as e:\n    msg = str(e)\n    if \"TokenHub task\" in msg and \"failed:\" in msg:\n        reason = msg.rsplit(\":\", 1)[-1].strip()\n        if any(k in reason.lower() for k in (\"rate\", \"busy\", \"internal\")):\n            time.sleep(30)\n            result = hunyuan_cloud_video(inputs)  # transient only\n        else:\n            raise GenerationRejected(reason) from e\n    else:\n        raise","preventionTips":["Branch on the provider's error message: retry only rate/internal reasons.","Keep prompts within content policy; verify model parameters against TokenHub docs.","Monitor account balance/quota before batch runs."],"tags":["hunyuan","tokenhub","provider-error","polling","generation-failed"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}