{"record":{"id":"2ec9a6baae6f9dbe","repo":"BerriAI/litellm","slug":"received-non-json-response-from-google-speech-to-t","errorCode":null,"errorMessage":"Received non-JSON response from Google Speech-to-Text: {raw_response.text}","messagePattern":"Received non-JSON response from Google Speech-to-Text: (.+?)","errorType":"http","errorClass":"VertexAIError","httpStatus":null,"severity":"error","filePath":"litellm/llms/vertex_ai/audio_transcription/transformation.py","lineNumber":167,"sourceCode":"        request_body: Final = VertexSpeechToTextRecognizeRequest(\n            config=VertexSpeechToTextRecognitionConfig(\n                model=model.removeprefix(\"vertex_ai/\"),\n                languageCodes=language_codes,\n                features=VertexSpeechToTextRecognitionFeatures(enableAutomaticPunctuation=True),\n                autoDecodingConfig=VertexSpeechToTextAutoDecodingConfig(),\n            ),\n            content=base64.b64encode(processed_audio.file_content).decode(\"utf-8\"),\n        )\n        return AudioTranscriptionRequestData(data=dict(request_body))\n\n    def transform_audio_transcription_response(\n        self,\n        raw_response: Response,\n    ) -> TranscriptionResponse:\n        try:\n            response_json: Final = raw_response.json()\n        except ValueError:\n            raise VertexAIError(\n                status_code=raw_response.status_code,\n                message=f\"Received non-JSON response from Google Speech-to-Text: {raw_response.text}\",\n            )\n        parsed: Final = VertexSpeechToTextRecognizeResponse.model_validate(response_json)\n        transcripts: Final = tuple(\n            result.alternatives[0].transcript\n            for result in parsed.results\n            if result.alternatives and result.alternatives[0].transcript\n        )\n        response: Final = TranscriptionResponse(text=\" \".join(transcripts))\n        response[\"task\"] = \"transcribe\"\n        detected_language: Final = next((result.languageCode for result in parsed.results if result.languageCode), None)\n        if detected_language is not None:\n            response[\"language\"] = detected_language\n        billed_duration = _parse_duration_seconds(parsed.metadata.totalBilledDuration if parsed.metadata else None)\n        if billed_duration is not None:\n            response[\"duration\"] = billed_duration\n        response._hidden_params = response_json","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/vertex_ai/audio_transcription/transformation.py#L149-L185","documentation":"Guard when parsing a non-JSON response from Google Speech-to-Text: the recognition response body could not be decoded as JSON, so the raw text is embedded in the error. Indicates the endpoint returned HTML/error text instead of a recognition result.","triggerScenarios":"Triggered when Google Speech-to-Text returns a non-JSON response body.","commonSituations":"See trigger scenarios.","solutions":["The Speech-to-Text endpoint returned non-JSON; inspect raw_response.text.","Check for proxy/endpoint misconfiguration or an HTML error page."],"exampleFix":"# log raw_response.text to see the actual content returned.","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"}