{"record":{"id":"2eacb41a63c5d242","repo":"calesthio/OpenMontage","slug":"dashscope-asr-task-task-id-did-not-finish-within","errorCode":null,"errorMessage":"DashScope ASR task {task_id} did not finish within {timeout_seconds}s","messagePattern":"DashScope ASR task (.+?) did not finish within (.+?)s","errorType":"exception","errorClass":"TimeoutError","httpStatus":null,"severity":"error","filePath":"tools/analysis/dashscope_asr.py","lineNumber":329,"sourceCode":"            time.sleep(poll_interval)\n            resp = requests_module.get(\n                self.POLL_URL_TEMPLATE.format(task_id=task_id),\n                headers=headers,\n                timeout=(10, 60),\n            )\n            data = self._json_or_raise(resp)\n            self._raise_for_error(resp.status_code, data)\n            status = data.get(\"output\", {}).get(\"task_status\")\n            if status == \"SUCCEEDED\":\n                return data\n            if status == \"FAILED\":\n                msg = data.get(\"output\", {}).get(\n                    \"message\", \"unknown error\"\n                )\n                raise RuntimeError(\n                    f\"DashScope ASR task failed: {msg}\"\n                )\n        raise TimeoutError(\n            f\"DashScope ASR task {task_id} did not finish within \"\n            f\"{timeout_seconds}s\"\n        )\n\n    @staticmethod\n    def _is_public_url(url: str) -> bool:\n        return url.startswith(\"http://\") or url.startswith(\"https://\")\n\n    @staticmethod\n    def _extract_words(\n        transcription: dict[str, Any]\n    ) -> list[dict[str, Any]]:\n        \"\"\"Extract flat word list with timestamps normalized to seconds.\"\"\"\n        words: list[dict[str, Any]] = []\n        for transcript in transcription.get(\"transcripts\", []):\n            for sentence in transcript.get(\"sentences\", []):\n                for word in sentence.get(\"words\", []):\n                    words.append(","sourceCodeStart":311,"sourceCodeEnd":347,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/analysis/dashscope_asr.py#L311-L347","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Increase timeout_seconds proportionally to audio duration (rule of thumb: allow at least 1-2 minutes per 10 minutes of audio, plus margin)","Retry the whole submit+poll flow with the same audio; if it consistently hangs, check Aliyun Bailian console for task status and quota","Verify the submitted file_url is publicly reachable (public http/https) — an unreachable input can leave the task non-terminal instead of FAILED","If tasks are large, split the audio into smaller segments and transcribe in parallel"],"exampleFix":"// before\nresult = asr.transcribe_file_url(url, timeout_seconds=300)\n\n// after\nresult = asr.transcribe_file_url(url, timeout_seconds=1800)  # scale to audio length","handlingStrategy":"retry","validationCode":"duration = probe_audio_duration(input_path)\ntimeout = max(300, int(duration * 4) + 120)  # generous budget for file transcription","typeGuard":null,"tryCatchPattern":"try:\n    result = asr.transcribe_file_url(url, timeout_seconds=timeout)\nexcept TimeoutError as e:\n    logger.warning(\"ASR timed out: %s; retrying with doubled budget\", e)\n    result = asr.transcribe_file_url(url, timeout_seconds=timeout * 2)","preventionTips":["Scale timeout_seconds to the audio duration, never use a fixed small default for long files","Split hour-plus recordings into segments and run tasks in parallel","Ensure the submitted file URL is publicly accessible so the task cannot stall on input fetch"],"tags":["dashscope","asr","timeout","polling","network"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}