calesthio/OpenMontage · error · RuntimeError
TokenHub task {task_id} returned unknown status: {status}
Error message
TokenHub task {task_id} returned unknown status: {status} What it means
Raised when the TokenHub poll returns a status string outside the recognized set {completed, failed, queued, running, in_progress}. The tool treats unknown states as errors rather than waiting indefinitely on a state it cannot interpret — this protects against both typos in the state machine and new provider states (e.g. 'cancelled', 'partial') appearing after an API update.
Source
Thrown at tools/video/hunyuan_cloud_video.py:486
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
# ------------------------------------------------------------------
@staticmethod
def _safe_error(exc: Exception) -> str:
"""Redact secret values from exception messages."""
msg = str(exc)
for var in ("TENCENT_TOKENHUB_API_KEY",):
val = os.environ.get(var, "")
if val:View on GitHub (pinned to 95e1c3d0ab)
Solutions
- Read the {status} value in the error and map it to its meaning in current TokenHub docs (e.g. 'cancelled' = aborted server-side, no retry value).
- If the new state is a valid in-flight state, update the whitelist in hunyuan_cloud_video's poll loop or update OpenMontage where the fix landed.
- Resubmit the task if the state is equivalent to a terminal abort.
- Report the new status string upstream so the state machine gets extended.
Defensive patterns
Strategy: try-catch
Try / catch
try:
result = hunyuan_cloud_video(inputs)
except RuntimeError as e:
if "unknown status" in str(e):
status = str(e).rsplit(":", 1)[-1].strip()
if status.lower() in ("cancelled", "canceled", "expired"):
raise TaskAborted(status) from e # terminal, do not retry
raise ProviderContractError(f"new TokenHub status: {status}") from e
raise Prevention
- Map unrecognized states explicitly instead of retrying them.
- Track TokenHub release notes for new lifecycle states and update whitelists.
When it happens
Trigger: Poll response JSON has data.status set to something like 'cancelled', 'expired', 'success', or 'PROCESSING' (different casing/wording introduced by the provider). The whitelist check fires immediately.
Common situations: TokenHub adds a new lifecycle state in an API revision; case or wording differences between endpoints; tasks cancelled server-side (e.g. by moderation) landing in an unmodelled state.
Related errors
- TokenHub task {task_id} completed but no data.url: {data}
- TokenHub submit returned no task id: {data}
- TokenHub task {task_id} did not finish within {timeout_secon
- TokenHub submit returned no task id: {data}
- TokenHub task {task_id} failed: {error_msg}
AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15).
Data as JSON: /api/errors/626f8e39b9112c24.
Report an issue: GitHub.