BerriAI/litellm · error · VertexAIError
Received non-JSON response from Google Speech-to-Text: {raw_
Error message
Received non-JSON response from Google Speech-to-Text: {raw_response.text} What it means
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.
Source
Thrown at litellm/llms/vertex_ai/audio_transcription/transformation.py:167
request_body: Final = VertexSpeechToTextRecognizeRequest(
config=VertexSpeechToTextRecognitionConfig(
model=model.removeprefix("vertex_ai/"),
languageCodes=language_codes,
features=VertexSpeechToTextRecognitionFeatures(enableAutomaticPunctuation=True),
autoDecodingConfig=VertexSpeechToTextAutoDecodingConfig(),
),
content=base64.b64encode(processed_audio.file_content).decode("utf-8"),
)
return AudioTranscriptionRequestData(data=dict(request_body))
def transform_audio_transcription_response(
self,
raw_response: Response,
) -> TranscriptionResponse:
try:
response_json: Final = raw_response.json()
except ValueError:
raise VertexAIError(
status_code=raw_response.status_code,
message=f"Received non-JSON response from Google Speech-to-Text: {raw_response.text}",
)
parsed: Final = VertexSpeechToTextRecognizeResponse.model_validate(response_json)
transcripts: Final = tuple(
result.alternatives[0].transcript
for result in parsed.results
if result.alternatives and result.alternatives[0].transcript
)
response: Final = TranscriptionResponse(text=" ".join(transcripts))
response["task"] = "transcribe"
detected_language: Final = next((result.languageCode for result in parsed.results if result.languageCode), None)
if detected_language is not None:
response["language"] = detected_language
billed_duration = _parse_duration_seconds(parsed.metadata.totalBilledDuration if parsed.metadata else None)
if billed_duration is not None:
response["duration"] = billed_duration
response._hidden_params = response_jsonView on GitHub (pinned to 77b7c6c40c)
Solutions
- The Speech-to-Text endpoint returned non-JSON; inspect raw_response.text.
- Check for proxy/endpoint misconfiguration or an HTML error page.
Example fix
# log raw_response.text to see the actual content returned.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Triggered when Google Speech-to-Text returns a non-JSON response body.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/2ec9a6baae6f9dbe.
Report an issue: GitHub.