{"record":{"id":"530e14f895895f83","repo":"calesthio/OpenMontage","slug":"doubao-task-failed-query-data-get-message-un","errorCode":null,"errorMessage":"Doubao task failed: {query_data.get('message', 'unknown error')}","messagePattern":"Doubao task failed: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"tools/audio/doubao_tts.py","lineNumber":360,"sourceCode":"        timeout_seconds: int,\n    ) -> dict[str, Any]:\n        deadline = time.time() + timeout_seconds\n        while time.time() < deadline:\n            time.sleep(poll_interval)\n            headers = self._headers(\n                api_key=api_key,\n                resource_id=resource_id,\n                request_id=str(uuid.uuid4()),\n                return_usage=return_usage,\n            )\n            response = requests_module.post(self.QUERY_URL, headers=headers, json={\"task_id\": task_id}, timeout=(10, 60))\n            query_data = self._json_or_raise(response)\n            self._raise_for_doubao_error(response.status_code, query_data)\n            status = query_data.get(\"data\", {}).get(\"task_status\")\n            if status == 2:\n                return query_data\n            if status == 3:\n                raise RuntimeError(f\"Doubao task failed: {query_data.get('message', 'unknown error')}\")\n        raise TimeoutError(f\"Doubao task did not finish within {timeout_seconds} seconds\")\n\n    @staticmethod\n    def _json_or_raise(response: Any) -> dict[str, Any]:\n        try:\n            return response.json()\n        except ValueError as exc:\n            raise RuntimeError(f\"Non-JSON response from Doubao API: HTTP {response.status_code}\") from exc\n\n    def _raise_for_doubao_error(self, http_status: int, payload: dict[str, Any]) -> None:\n        code = payload.get(\"code\")\n        if http_status < 400 and code == 20000000:\n            return\n        message = payload.get(\"message\", \"unknown error\")\n        hint = self._diagnostic_hint(message)\n        raise RuntimeError(f\"HTTP {http_status}, code {code}: {message}{hint}\")\n\n    @staticmethod","sourceCodeStart":342,"sourceCodeEnd":378,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/audio/doubao_tts.py#L342-L378","documentation":"Raised inside _poll_query when the Doubao task query returns data.task_status == 3, the API's failure status. The message embeds the top-level message field from the query payload (falling back to 'unknown error'), so the actual failure reason comes from the service: invalid voice, quota, content moderation, etc.","triggerScenarios":"Any submit accepted but processing failed server-side: unauthorized voice_id, text failing content moderation, malformed encoding parameters, exhausted character package, or resource misconfiguration.","commonSituations":"voice_type not authorized for the API key; Chinese text sent with mismatched language parameters; free quota used up; account not activated for the speech resource.","solutions":["Read the message text — it is the upstream failure reason (e.g. speaker permission denied, quota exceeded)","Match it against _diagnostic_hint categories: key flow, voice authorization, quota, or additions.explicit_language misuse","Fix the underlying cause (authorize the voice, top up quota, remove unsupported fields) and resubmit","If message is 'unknown error', log the full query_data for support escalation"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    result = doubao_tool.execute(inputs)\nexcept RuntimeError as e:\n    msg = str(e)\n    if \"quota\" in msg.lower():\n        alert_billing()\n    elif \"permission denied\" in msg.lower():\n        alert_voice_config()\n    else:\n        raise","preventionTips":["Pre-authorize voice_id for the account before batch runs","Monitor remaining character package quota before long jobs","Keep text within moderation-safe content to avoid status-3 failures"],"tags":["doubao","tts","task-failed","polling"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}