calesthio/OpenMontage · error · RuntimeError
TokenHub task {task_id} failed: {error_msg}
Error message
TokenHub task {task_id} failed: {error_msg} What it means
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.
Source
Thrown at tools/video/hunyuan_cloud_video.py:480
)
data = self._json_or_raise(resp)
self._check_response(data)
status = data.get("status", "")
if status == "completed":
result_data = data.get("data") or {}
video_url = result_data.get("url")
if not video_url:
raise RuntimeError(
f"TokenHub task {task_id} completed but no data.url: {data}"
)
return video_url
if status == "failed":
error_info = data.get("error") or {}
error_msg = error_info.get("message", "unknown error")
raise RuntimeError(
f"TokenHub task {task_id} failed: {error_msg}"
)
# queued / running / in_progress — continue polling
if status not in ("queued", "running", "in_progress"):
raise RuntimeError(
f"TokenHub task {task_id} returned unknown status: {status}"
)
raise TimeoutError(
f"TokenHub task {task_id} did not finish within {timeout_seconds}s"
)
# ------------------------------------------------------------------
# Error handling helpers
# ------------------------------------------------------------------
@staticmethodView on GitHub (pinned to 95e1c3d0ab)
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.
Defensive patterns
Strategy: try-catch
Try / catch
try:
result = hunyuan_cloud_video(inputs)
except RuntimeError as e:
msg = str(e)
if "TokenHub task" in msg and "failed:" in msg:
reason = msg.rsplit(":", 1)[-1].strip()
if any(k in reason.lower() for k in ("rate", "busy", "internal")):
time.sleep(30)
result = hunyuan_cloud_video(inputs) # transient only
else:
raise GenerationRejected(reason) from e
else:
raise Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- TokenHub task {task_id} did not finish within {timeout_secon
- TokenHub task {task_id} completed but no data.url: {data}
- TokenHub task {task_id} returned unknown status: {status}
- TokenHub task {task_id} did not finish within {timeout_secon
- TokenHub API error: code={code}, message={message}
AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15).
Data as JSON: /api/errors/1a10141745a99839.
Report an issue: GitHub.