calesthio/OpenMontage · error · RuntimeError

TokenHub task {task_id} failed: {error_msg}

Error message

TokenHub task {task_id} failed: {error_msg}

What it means

RuntimeError raised when the polled TokenHub task reaches status 'failed'. The poller extracts error.message from the task payload (defaulting to 'unknown error' when absent) and surfaces it to the caller; this is the provider's own failure report, not a client-side error.

Source

Thrown at tools/graphics/hunyuan_image.py:511

            )
            data = self._json_or_raise(resp)
            self._check_response(data)

            status = data.get("status", "")

            if status == "completed":
                result_data = data.get("data") or []
                urls = [item.get("url") for item in result_data if item.get("url")]
                if not urls:
                    raise RuntimeError(
                        f"TokenHub task {task_id} completed but no data[].url: {data}"
                    )
                return urls

            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

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Read the embedded error_msg — it is the provider's reason and dictates the fix
  2. For content errors, rephrase the prompt and remove disallowed elements
  3. For transient/unknown errors, retry once after a short delay before escalating
  4. Check the TokenHub console for account quota and concurrency limits
Defensive patterns

Strategy: retry

Try / catch

import time
for attempt in range(2):
    try:
        urls = client._poll_task(task_id, ...)
        break
    except RuntimeError as e:
        if "failed:" in str(e) and "unknown error" in str(e) and attempt == 0:
            time.sleep(5)  # one retry for opaque transient failures
            continue
        raise

Prevention

When it happens

Trigger: Any Hunyuan image generation the upstream service rejects or crashes on: content moderation, invalid parameters accepted at submit time, upstream GPU failures, or quota exhaustion mid-job.

Common situations: Prompts with policy-violating content; rare transient upstream failures that succeed on retry; hitting a concurrent-task limit that manifests as a failed status rather than an HTTP error.

Related errors


AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15). Data as JSON: /api/errors/ef8fdc2242270363. Report an issue: GitHub.