{"record":{"id":"84a1d98c407f3c22","repo":"BerriAI/litellm","slug":"request-did-not-return-a-200-status-code-respons","errorCode":null,"errorMessage":"Request did not return a 200 status code: {response.status_code}, {response.text}","messagePattern":"Request did not return a 200 status code: (.+?), (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/llms/vertex_ai/text_to_speech/text_to_speech_handler.py","lineNumber":188,"sourceCode":"    async def async_audio_speech(\n        self,\n        logging_obj,\n        url: str,\n        headers: dict,\n        request: VertexTextToSpeechRequest,\n    ) -> HttpxBinaryResponseContent:\n        import base64\n\n        async_handler: Final = get_async_httpx_client(llm_provider=litellm.LlmProviders.VERTEX_AI)\n\n        response = await async_handler.post(\n            url=url,\n            headers=headers,\n            json=request,\n        )\n\n        if response.status_code != 200:\n            raise Exception(f\"Request did not return a 200 status code: {response.status_code}, {response.text}\")\n\n        _json_response: Final = response.json()\n\n        response_content: Final = _json_response[\"audioContent\"]\n\n        # Decode base64 to get binary content\n        binary_data: Final = base64.b64decode(response_content)\n\n        # Create an httpx.Response object\n        response = httpx.Response(\n            status_code=200,\n            content=binary_data,\n        )\n\n        # Initialize the HttpxBinaryResponseContent instance\n        http_binary_response: Final = HttpxBinaryResponseContent(response)\n        return http_binary_response\n","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/vertex_ai/text_to_speech/text_to_speech_handler.py#L170-L206","documentation":"Raised in async_audio_speech when the awaited POST to the Vertex AI speech endpoint returns non-200; status and body are embedded. Same failure class as the sync path: bad request payload, auth, or quota.","triggerScenarios":"Thrown at litellm/llms/vertex_ai/text_to_speech/text_to_speech_handler.py:188 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the status code and response text in the error to identify the upstream failure (permissions, billing, invalid input).","Confirm the Vertex AI Text-to-Speech API is enabled on the project and the credentials have the required IAM roles."],"exampleFix":null,"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-14T05:17:10.506Z"}