{"record":{"id":"bd07ad63b310d224","repo":"HKUDS/DeepTutor","slug":"dashscope-multimodalembedding-call-failed-status","errorCode":null,"errorMessage":"DashScope MultiModalEmbedding call failed: status={status_code}, code={code}, message={message}, model={model_name}, request_id={request_id}","messagePattern":"DashScope MultiModalEmbedding call failed: status=(.+?), code=(.+?), message=(.+?), model=(.+?), request_id=(.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"deeptutor/services/embedding/adapters/dashscope_native.py","lineNumber":175,"sourceCode":"        resp = await asyncio.to_thread(\n            TextEmbedding.call,\n            api_key=self.api_key,\n            model=model_name,\n            input=inputs,\n            **parameters,\n        )\n\n        self._raise_on_error(resp, model_name)\n        return self._parse_response(resp, model_name, request)\n\n    def _raise_on_error(self, resp: Any, model_name: str) -> None:\n        status_code = getattr(resp, \"status_code\", None)\n        if status_code is None or status_code == HTTPStatus.OK:\n            return\n        code = getattr(resp, \"code\", \"\") or \"\"\n        message = getattr(resp, \"message\", \"\") or \"\"\n        request_id = getattr(resp, \"request_id\", \"\") or \"\"\n        raise RuntimeError(\n            f\"DashScope MultiModalEmbedding call failed: \"\n            f\"status={status_code}, code={code}, message={message}, \"\n            f\"model={model_name}, request_id={request_id}\"\n        )\n\n    def _parse_response(\n        self, resp: Any, model_name: str, request: EmbeddingRequest\n    ) -> EmbeddingResponse:\n        output = getattr(resp, \"output\", None)\n        if output is None:\n            raise ValueError(\n                f\"DashScope response missing `output` (request_id={getattr(resp, 'request_id', '')})\"\n            )\n\n        # `output` is dict-like in the SDK.\n        if isinstance(output, dict):\n            raw = output.get(\"embeddings\") or []\n        else:","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/services/embedding/adapters/dashscope_native.py#L157-L193","documentation":"_raise_on_error inspects the DashScope SDK response and, when status_code is present and != 200, raises RuntimeError embedding status, error code, message, model, and request_id. It is the adapter's uniform translation of DashScope API failures (auth, quota, bad model, invalid params) into a Python exception with full diagnostic context.","triggerScenarios":"Any _embed_multimodal/_embed_text call where the DashScope endpoint returns non-200: invalid API key, nonexistent model, rate limiting, malformed inputs.","commonSituations":"DASHSCOPE_API_KEY missing/revoked; model not enabled for the account (e.g. multimodal model on a text-only tier); throttling under batch indexing load.","solutions":["Map the embedded code: 401/InvalidApiKey -> fix DASHSCOPE_API_KEY; invalid model -> correct the model name; 429 -> back off and retry","Retry idempotent embedding calls with exponential backoff; keep request_id for support tickets","Verify the account has access to the requested model (e.g. multimodal-embedding-one)"],"exampleFix":"# before\nresp = await adapter.embed(req)  # RuntimeError: status=401, code=InvalidApiKey\n# after\nimport os, asyncio\nassert os.environ.get(\"DASHSCOPE_API_KEY\"), \"set DASHSCOPE_API_KEY\"\nfor attempt in range(3):\n    try:\n        resp = await adapter.embed(req)\n        break\n    except RuntimeError as e:\n        if \"status=429\" in str(e) and attempt < 2:\n            await asyncio.sleep(2 ** attempt)\n        else:\n            raise","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"for attempt in range(4):\n    try:\n        return await adapter.embed(req)\n    except RuntimeError as e:\n        msg = str(e)\n        if \"status=429\" in msg and attempt < 3:\n            await asyncio.sleep(2 ** attempt)\n            continue\n        if \"status=401\" in msg or \"InvalidApiKey\" in msg:\n            raise ConfigError(\"bad DASHSCOPE_API_KEY\") from e\n        raise","preventionTips":["Wrap batch indexing with backoff on 429","Fail fast on auth errors; don't retry them","Log request_id from the message for support correlation"],"tags":["dashscope","api-error","embeddings","authentication"],"backgroundTag":"provider-api-error","analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}