{"record":{"id":"65d81e45de6b5c6a","repo":"BerriAI/litellm","slug":"str-await-response-aread","errorCode":null,"errorMessage":"str(await response.aread())","messagePattern":"str\\(await response\\.aread\\(\\)\\)","errorType":"exception","errorClass":"VertexAgentEngineError","httpStatus":null,"severity":"error","filePath":"litellm/llms/vertex_ai/agent_engine/transformation.py","lineNumber":449,"sourceCode":"        from litellm.utils import CustomStreamWrapper\n\n        if client is None or not isinstance(client, AsyncHTTPHandler):\n            client = get_async_httpx_client(llm_provider=cast(Any, \"vertex_ai\"), params={})\n\n        # Avoid logging sensitive api_base directly\n        verbose_logger.debug(\"Making async streaming request to Vertex AI endpoint.\")\n\n        # Make async streaming request\n        response: Final = await client.post(\n            api_base,\n            headers=headers,\n            data=json.dumps(data),\n            stream=True,\n            logging_obj=logging_obj,\n        )\n\n        if response.status_code != 200:\n            raise VertexAgentEngineError(status_code=response.status_code, message=str(await response.aread()))\n\n        # Create iterator for SSE stream (async)\n        completion_stream: Final = VertexAgentEngineResponseIterator(\n            streaming_response=response.aiter_lines(),\n            sync_stream=False,\n        )\n\n        streaming_response: Final = CustomStreamWrapper(\n            completion_stream=completion_stream,\n            model=model,\n            custom_llm_provider=custom_llm_provider,\n            logging_obj=logging_obj,\n        )\n\n        # LOGGING\n        logging_obj.post_call(\n            input=messages,\n            api_key=\"\",","sourceCodeStart":431,"sourceCodeEnd":467,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/vertex_ai/agent_engine/transformation.py#L431-L467","documentation":"Response-body placeholder in the Vertex AI Agent Engine async streaming path: after client.post, a non-success response is converted to an error whose message is the raw body (via str(await response.aread())). Fires when the agent-engine endpoint rejects the streaming request (auth, quota, bad payload).","triggerScenarios":"Triggered when the Vertex Agent Engine async response indicates an error; the response body is surfaced.","commonSituations":"See trigger scenarios.","solutions":["Inspect the raw async response content for the error detail.","Verify Agent Engine endpoint configuration and credentials."],"exampleFix":"# print the raw response body from the raised error.","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}