calesthio/OpenMontage · error · RuntimeError
DashScope ASR task failed: {msg}
Error message
DashScope ASR task failed: {msg} What it means
Raised by the DashScope ASR poll loop when output.task_status is FAILED. The message embeds output.message (defaulting to 'unknown error'), which is the service's stated reason for the transcription failure.
Source
Thrown at tools/analysis/dashscope_asr.py:326
deadline = time.time() + timeout_seconds
headers = {"Authorization": f"Bearer {api_key}"}
while time.time() < deadline:
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", []):View on GitHub (pinned to 95e1c3d0ab)
Solutions
- Read output.message in the raised error — it names the exact failure (download failed, format unsupported, quota, etc.)
- If passing a URL, verify it is publicly accessible (curl it from another host) and unexpired
- Convert the audio to a supported format (e.g. 16kHz mono wav/mp3) with ffmpeg before submitting
- Check file size/duration against DashScope file-transcription limits and trim or split
- Check DashScope console for quota/billing status
Example fix
# before payload['file_urls'] = ['file:///tmp/interview.mp3'] # not fetchable # after — host the file publicly (or use the service's recommended upload path) import requests requests.head(audio_url, timeout=10).raise_for_status() # preflight payload['file_urls'] = [audio_url]
Defensive patterns
Strategy: try-catch
Validate before calling
import requests
def audio_url_fetchable(url: str) -> bool:
try:
r = requests.head(url, timeout=10, allow_redirects=True)
return r.status_code == 200
except requests.RequestException:
return False Type guard
def is_supported_audio(path: str) -> bool:
from pathlib import Path
return Path(path).suffix.lower() in {'.wav', '.mp3', '.m4a', '.aac', '.flac', '.ogg'} Try / catch
try:
result = tool.run(inputs)
except RuntimeError as e:
if 'DashScope ASR task failed' in str(e):
msg = str(e).split('failed:')[-1].strip()
if 'download' in msg.lower():
inputs['file_urls'] = [refresh_presigned_url(inputs['file_urls'][0])]
result = tool.run(inputs)
else:
raise
else:
raise Prevention
- Preflight public URLs with a HEAD request before submitting
- Use long-lived pre-signed URLs or upload to the service's recommended storage
- Convert to supported formats (16kHz mono wav/mp3) with ffmpeg first
- Respect file size/duration limits — split long recordings
When it happens
Trigger: Submitting an audio URL that is not publicly reachable (signed URL expired, private bucket, localhost/内网 address); unsupported or corrupt audio format; file too large or too long for the file-transcription limits; invalid parameters like a wrong file_url type.
Common situations: Passing pre-signed cloud URLs that expire before DashScope fetches them; local file paths mistaken for URLs; unsupported codecs (e.g. some .m4a variants); exceeding the service's max duration/file size; quota exhausted.
Related errors
- Kling Classic task failed
- Kling Turbo task failed
- DashScope ASR submit succeeded but did not return output.tas
- DashScope ASR task succeeded but result.transcription_url mi
- DashScope ASR task {task_id} did not finish within {timeout_
AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15).
Data as JSON: /api/errors/62a1de129b122e25.
Report an issue: GitHub.