{"record":{"id":"709f8c218307cdb3","repo":"BerriAI/litellm","slug":"request-failed-with-status-code-response-status-c","errorCode":null,"errorMessage":"Request failed with status code {response.status_code}, {response.text}","messagePattern":"Request failed with status code (.+?), (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/llms/vertex_ai/text_to_speech/text_to_speech_handler.py","lineNumber":151,"sourceCode":"                \"complete_input_dict\": request,\n                \"api_base\": url,\n                \"headers\": headers,\n            },\n        )\n\n        ########## End of logging ############\n        ####### Send the request ###################\n        if _is_async is True:\n            return self.async_audio_speech(logging_obj=logging_obj, url=url, headers=headers, request=request)\n        sync_handler: Final = _get_httpx_client()\n\n        response = sync_handler.post(\n            url=url,\n            headers=headers,\n            json=request,\n        )\n        if response.status_code != 200:\n            raise Exception(f\"Request failed with status code {response.status_code}, {response.text}\")\n        ############ Process the response ############\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":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/vertex_ai/text_to_speech/text_to_speech_handler.py#L133-L169","documentation":"Raised in the sync Vertex AI text-to-speech path when the POST returns non-200; status and body are embedded. Fires on invalid voice/audio config, auth, or quota errors from the speech endpoint.","triggerScenarios":"Thrown at litellm/llms/vertex_ai/text_to_speech/text_to_speech_handler.py:151 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the status code and response body in the error for the upstream cause (auth, quota, invalid voice/params).","Verify vertex credentials, project/location, and the TTS request parameters (voice, language_code, model) are valid."],"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-14T00:17:10.932Z"}