{"record":{"id":"473a68254c92734c","repo":"calesthio/OpenMontage","slug":"dashscope-asr-task-succeeded-but-result-transcript","errorCode":null,"errorMessage":"DashScope ASR task succeeded but result.transcription_url missing","messagePattern":"DashScope ASR task succeeded but result\\.transcription_url missing","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"tools/analysis/dashscope_asr.py","lineNumber":242,"sourceCode":"                \"DashScope ASR submit succeeded but did not return \"\n                \"output.task_id\"\n            )\n\n        # Poll\n        poll_data = self._poll_task(\n            requests_module=requests,\n            api_key=api_key,\n            task_id=task_id,\n            poll_interval=float(inputs.get(\"poll_interval_seconds\", 5.0)),\n            timeout_seconds=int(inputs.get(\"timeout_seconds\", 300)),\n        )\n\n        # qwen3-asr-flash-filetrans returns output.result.transcription_url\n        # (singular \"result\", NOT \"results\" array like paraformer-v2)\n        result = poll_data.get(\"output\", {}).get(\"result\", {})\n        transcription_url = result.get(\"transcription_url\")\n        if not transcription_url:\n            raise RuntimeError(\n                \"DashScope ASR task succeeded but \"\n                \"result.transcription_url missing\"\n            )\n\n        # Download transcription JSON\n        trans_resp = requests.get(transcription_url, timeout=120)\n        trans_resp.raise_for_status()\n        transcription = trans_resp.json()\n\n        # Save full transcription\n        output_path = Path(\n            inputs.get(\"output_path\", \"dashscope_asr.json\")\n        )\n        output_path.parent.mkdir(parents=True, exist_ok=True)\n        output_path.write_text(\n            json.dumps(transcription, ensure_ascii=False, indent=2) + \"\\n\",\n            encoding=\"utf-8\",\n        )","sourceCodeStart":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/analysis/dashscope_asr.py#L224-L260","documentation":"Raised when the DashScope ASR polling loop reports SUCCEEDED but output.result.transcription_url is missing. The code deliberately reads the singular 'result' object (qwen3-asr-flash-filetrans shape) rather than the 'results' array used by paraformer-v2, so a missing URL means the success payload does not match the expected schema.","triggerScenarios":"Task marked SUCCEEDED before results finished materializing (result object empty); using a paraformer-family model whose output uses output.results[] instead; API shape change moving the URL (e.g. to output.result.file_url or a transcriptionUrls list).","commonSituations":"Model name drift between qwen3-asr-flash-filetrans and paraformer-v2 file-transcription (different result envelopes); polling immediately after SUCCEEDED on a partially materialized result; DashScope contract update.","solutions":["Log poll_data['output'] to see the actual success payload structure","Confirm the model is qwen3-asr-flash-filetrans; if using paraformer-v2, read output.results[].transcription_url instead","Retry the download/poll once after a few seconds in case the result materializes late","Update the result extraction to the current documented schema"],"exampleFix":"// before\nresult = poll_data.get('output', {}).get('result', {})\ntranscription_url = result.get('transcription_url')\n\n// after (handle both envelope shapes)\nout = poll_data.get('output', {})\nurl = (out.get('result') or {}).get('transcription_url')\nif not url:\n    for item in out.get('results') or []:\n        url = url or item.get('transcription_url')\nif not url:\n    raise RuntimeError(f'no transcription_url in output: {out}')","handlingStrategy":"try-catch","validationCode":"def result_has_transcription_url(poll_data: dict) -> bool:\n    out = poll_data.get('output') or {}\n    if (out.get('result') or {}).get('transcription_url'):\n        return True\n    return any((r or {}).get('transcription_url') for r in out.get('results') or [])","typeGuard":null,"tryCatchPattern":"try:\n    result = tool.run(inputs)\nexcept RuntimeError as e:\n    if 'transcription_url missing' in str(e):\n        time.sleep(5)\n        result = tool.run(inputs)  # result may materialize late; one retry\n    else:\n        raise","preventionTips":["Keep the model id and the result-extraction code in sync (qwen3 -> result, paraformer -> results[])","Log the SUCCEEDED output payload when the URL is missing","Retry once after a short delay — late materialization happens"],"tags":["dashscope","asr","api","response-shape","schema-drift"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}