calesthio/OpenMontage · error · TimeoutError

DashScope ASR task {task_id} did not finish within {timeout_

Error message

DashScope ASR task {task_id} did not finish within {timeout_seconds}s

What it means

Raised when a DashScope async ASR (file transcription) task is polled repeatedly but never reaches SUCCEEDED or FAILED before the caller-supplied timeout elapses. The polling loop consumes the entire timeout budget while the remote task stays in a non-terminal state (e.g. PENDING or RUNNING). It is a TimeoutError, signaling an externally slow or stuck job rather than a local bug.

Source

Thrown at tools/analysis/dashscope_asr.py:329

            time.sleep(poll_interval)
            resp = requests_module.get(
                self.POLL_URL_TEMPLATE.format(task_id=task_id),
                headers=headers,
                timeout=(10, 60),
            )
            data = self._json_or_raise(resp)
            self._raise_for_error(resp.status_code, data)
            status = data.get("output", {}).get("task_status")
            if status == "SUCCEEDED":
                return data
            if status == "FAILED":
                msg = data.get("output", {}).get(
                    "message", "unknown error"
                )
                raise RuntimeError(
                    f"DashScope ASR task failed: {msg}"
                )
        raise TimeoutError(
            f"DashScope ASR task {task_id} did not finish within "
            f"{timeout_seconds}s"
        )

    @staticmethod
    def _is_public_url(url: str) -> bool:
        return url.startswith("http://") or url.startswith("https://")

    @staticmethod
    def _extract_words(
        transcription: dict[str, Any]
    ) -> list[dict[str, Any]]:
        """Extract flat word list with timestamps normalized to seconds."""
        words: list[dict[str, Any]] = []
        for transcript in transcription.get("transcripts", []):
            for sentence in transcript.get("sentences", []):
                for word in sentence.get("words", []):
                    words.append(

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Increase timeout_seconds proportionally to audio duration (rule of thumb: allow at least 1-2 minutes per 10 minutes of audio, plus margin)
  2. Retry the whole submit+poll flow with the same audio; if it consistently hangs, check Aliyun Bailian console for task status and quota
  3. Verify the submitted file_url is publicly reachable (public http/https) — an unreachable input can leave the task non-terminal instead of FAILED
  4. If tasks are large, split the audio into smaller segments and transcribe in parallel

Example fix

// before
result = asr.transcribe_file_url(url, timeout_seconds=300)

// after
result = asr.transcribe_file_url(url, timeout_seconds=1800)  # scale to audio length
Defensive patterns

Strategy: retry

Validate before calling

duration = probe_audio_duration(input_path)
timeout = max(300, int(duration * 4) + 120)  # generous budget for file transcription

Try / catch

try:
    result = asr.transcribe_file_url(url, timeout_seconds=timeout)
except TimeoutError as e:
    logger.warning("ASR timed out: %s; retrying with doubled budget", e)
    result = asr.transcribe_file_url(url, timeout_seconds=timeout * 2)

Prevention

When it happens

Trigger: Calling the DashScope qwen3-asr-flash-filetrans submit-then-poll flow with a long audio file that takes longer than timeout_seconds to transcribe; polling a task whose task_status stays PENDING/RUNNING because the service is congested; passing a small timeout_seconds relative to media duration.

Common situations: Hour-long recordings transcribed with the default timeout; DashScope regional outages or queue backlogs making tasks hang in RUNNING; network hiccups making each poll iteration slow so fewer polls fit in the window; uploading a very large file that spends most of the budget in server-side preprocessing.

Understand the failure class

Related errors


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