{"record":{"id":"cba445270f135583","repo":"BerriAI/litellm","slug":"azure-ai-speech-transcription-failed-with-recognit","errorCode":null,"errorMessage":"Azure AI Speech transcription failed with RecognitionStatus={recognition_status}.","messagePattern":"Azure AI Speech transcription failed with RecognitionStatus=(.+?)\\.","errorType":"http","errorClass":"AzureSpeechAudioTranscriptionException","httpStatus":null,"severity":"error","filePath":"litellm/llms/azure/audio_transcription/transformation.py","lineNumber":132,"sourceCode":"        audio_file: FileTypes,\n        optional_params: dict,\n        litellm_params: dict,\n    ) -> AudioTranscriptionRequestData:\n        processed_audio: Final = process_audio_file(audio_file)\n        return AudioTranscriptionRequestData(\n            data=processed_audio.file_content,\n            files=None,\n            content_type=processed_audio.content_type,\n        )\n\n    def transform_audio_transcription_response(\n        self,\n        raw_response: httpx.Response,\n    ) -> TranscriptionResponse:\n        response_json: Final = raw_response.json()\n        recognition_status: Final = response_json.get(\"RecognitionStatus\")\n        if recognition_status is not None and recognition_status != \"Success\":\n            raise AzureSpeechAudioTranscriptionException(\n                message=(f\"Azure AI Speech transcription failed with RecognitionStatus={recognition_status}.\"),\n                status_code=raw_response.status_code,\n                headers=raw_response.headers,\n            )\n\n        text: Final = self._extract_text(response_json)\n        response: Final = TranscriptionResponse(text=text)\n        response._hidden_params = response_json\n        return response\n\n    def get_error_class(self, error_message: str, status_code: int, headers: dict | httpx.Headers) -> BaseLLMException:\n        return AzureSpeechAudioTranscriptionException(\n            message=error_message,\n            status_code=status_code,\n            headers=headers,\n        )\n\n    def _resolve_stt_base_url(self, api_base: str) -> str:","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/azure/audio_transcription/transformation.py#L114-L150","documentation":"After Azure's speech-to-text API returns, LiteLLM inspects the `RecognitionStatus` field of the JSON body. Any value other than 'Success' (e.g. 'NoMatch', 'InitialSilenceTimeout', 'BabbleTimeout', 'Error') raises this exception with the HTTP status of the raw response attached. It means the request reached Azure but recognition itself did not succeed.","triggerScenarios":"Transcribing audio that contains no speech (NoMatch), leading or trailing silence beyond Azure's limits (InitialSilenceTimeout), noise-only audio (BabbleTimeout), or corrupt/unsupported audio containers that Azure partially accepts. Also triggered by wrong `language` parameter for the spoken content.","commonSituations":"Batch pipelines feeding short or silent clips; uploading 8kHz phone audio to a model expecting 16kHz WAV; specifying language='en-US' for non-English audio; microphone recordings with long silent openings.","solutions":["Inspect the full response stored in response._hidden_params / the exception body for the exact RecognitionStatus value.","Pre-check audio: non-empty, correct sample rate (16kHz for STT v3.1), valid WAV/OGG container, reasonable duration.","Match the `language` optional param to the spoken language of the audio.","For silence timeouts, trim leading/trailing silence or raise speech phrases thresholds before sending.","Treat NoMatch as a soft failure: log and skip the file rather than retrying, since retrying identical audio yields the same result."],"exampleFix":"# before\nresp = litellm.transcription(model='azure/speech', file=f, api_base=base, api_key=key)\ntext = resp.text\n\n# after\nfrom litellm.exceptions import LiteLLMException\ntry:\n    resp = litellm.transcription(model='azure/speech', file=f, api_base=base, api_key=key, language='en-US')\n    text = resp.text\nexcept LiteLLMException as e:\n    if 'RecognitionStatus=NoMatch' in str(e):\n        text = ''  # no speech detected; skip clip\n    else:\n        raise","handlingStrategy":"try-catch","validationCode":"import wave\n\nwith wave.open(path) as w:\n    assert w.getnframes() > 0, 'audio file has no frames'\n    assert w.getframerate() >= 16000, 'use 16kHz+ WAV for best recognition'","typeGuard":null,"tryCatchPattern":"from litellm.exceptions import LiteLLMException\n\ntry:\n    resp = litellm.transcription(model=azure_speech_model, file=f, api_base=base, api_key=key)\nexcept LiteLLMException as e:\n    msg = str(e)\n    if 'RecognitionStatus=NoMatch' in msg or 'Timeout' in msg:\n        return ''  # audio-level issue: skip, do not retry identical input\n    raise","preventionTips":["Pre-validate audio duration, sample rate, and container before submitting.","Always pass `language` matching the audio's spoken language.","Log recognition status per file in batch jobs to detect systematic audio problems."],"tags":["azure","speech","api-error","audio-quality","recognition"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}