{"record":{"id":"ca1a34334aa8d988","repo":"FoundationAgents/MetaGPT","slug":"request-failed-msg-resp-please-ref-to-https","errorCode":null,"errorMessage":"Request failed, msg: {resp}, please ref to `https://open.bigmodel.cn/dev/api#error-code-v3`","messagePattern":"Request failed, msg: (.+?), please ref to `https://open\\.bigmodel\\.cn/dev/api#error-code-v3`","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"metagpt/provider/zhipuai/zhipu_model_api.py","lineNumber":46,"sourceCode":"        requester = GeneralAPIRequestor(base_url=base_url)\n        result, _, api_key = await requester.arequest(\n            method=method,\n            url=url,\n            headers=headers,\n            stream=stream,\n            params=kwargs,\n            request_timeout=ZHIPUAI_DEFAULT_TIMEOUT.read,\n        )\n        return result\n\n    async def acreate(self, **kwargs) -> dict:\n        \"\"\"async invoke different from raw method `async_invoke` which get the final result by task_id\"\"\"\n        headers = self._default_headers\n        resp = await self.arequest(stream=False, method=\"post\", headers=headers, kwargs=kwargs)\n        resp = resp.data.decode(\"utf-8\")\n        resp = json.loads(resp)\n        if \"error\" in resp:\n            raise RuntimeError(\n                f\"Request failed, msg: {resp}, please ref to `https://open.bigmodel.cn/dev/api#error-code-v3`\"\n            )\n        return resp\n\n    async def acreate_stream(self, **kwargs) -> AsyncSSEClient:\n        \"\"\"async sse_invoke\"\"\"\n        headers = self._default_headers\n        return AsyncSSEClient(await self.arequest(stream=True, method=\"post\", headers=headers, kwargs=kwargs))\n","sourceCodeStart":28,"sourceCodeEnd":55,"githubUrl":"https://github.com/FoundationAgents/MetaGPT/blob/11cdf466d042aece04fc6cfd13b28e1a70341b1f/metagpt/provider/zhipuai/zhipu_model_api.py#L28-L55","documentation":"ZhipuModelAPI.acreate (non-streaming async invocation) decodes the JSON response and checks for an 'error' key; if present it raises RuntimeError with the whole response payload plus a reference to BigModel's error-code page. This is the generic wrapper for any application-level API error ZhipuAI returns (auth, quota, invalid params, content policy).","triggerScenarios":"Any await of acreate with bad input: wrong API key, exceeding rate limits, unknown model, malformed messages, or disallowed content; the response body is a JSON object containing \"error\".","commonSituations":"Invalid/expired ZHIPUAI_API_KEY, free-tier quota exhaustion, parameter mismatches after SDK upgrades, or prompt content flagged by Zhipu's moderation.","solutions":["Parse the error object inside the exception text for the official errCode and act on it (429 -> backoff, 1001/1002 -> fix key, 1113 -> rework prompt).","For rate limits, retry with exponential backoff and jitter.","Verify API key and that the model name (e.g. glm-4) is still supported.","Upgrade the metagpt zhipuai vendored client if error schemas changed."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"import asyncio\n\nfor attempt in range(3):\n    try:\n        resp = await api.acreate(**kwargs)\n        break\n    except RuntimeError as e:\n        if \"error-code-v3\" not in str(e) or not is_retryable(str(e)):\n            raise  # auth/content errors are not retryable\n        await asyncio.sleep(2 ** attempt)","preventionTips":["Retry only transient Zhipu errors (rate limit, server busy)","Surface the upstream error code in logs","Keep model names current with Zhipu's docs"],"tags":["zhipuai","api-error","json","retry"],"backgroundTag":null,"analyzedSha":"11cdf466d042aece04fc6cfd13b28e1a70341b1f","analyzedAt":"2026-08-14T23:20:02.994Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}