{"record":{"id":"a485bf6dba7962a1","repo":"BerriAI/litellm","slug":"could-not-extract-file-content-from-audio-file","errorCode":null,"errorMessage":"Could not extract file content from audio_file","messagePattern":"Could not extract file content from audio_file","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/litellm_core_utils/audio_utils/utils.py","lineNumber":110,"sourceCode":"                file_content = content.read()\n                if hasattr(content, \"seek\"):\n                    content.seek(0)\n            else:\n                raise ValueError(f\"Unsupported content type in tuple: {type(content)}\")\n        else:\n            raise ValueError(\"Tuple must have at least 2 elements: (filename, content)\")\n    elif hasattr(audio_file, \"read\") and not isinstance(audio_file, (str, bytes, bytearray, tuple, os.PathLike)):\n        # File-like object (IO) - check this after all other types\n        filename = getattr(audio_file, \"name\", \"audio.wav\")\n        file_content = audio_file.read()\n        # Reset file pointer if possible\n        if hasattr(audio_file, \"seek\"):\n            audio_file.seek(0)\n    else:\n        raise ValueError(f\"Unsupported audio_file type: {type(audio_file)}\")\n\n    if file_content is None:\n        raise ValueError(\"Could not extract file content from audio_file\")\n\n    # Determine content type using LiteLLM's file type utilities\n    content_type = \"audio/wav\"  # Default fallback\n    if filename:\n        try:\n            # Extract extension from filename\n            extension: Final = filename.split(\".\")[-1].lower() if \".\" in filename else \"wav\"\n            content_type = get_file_mime_type_from_extension(extension)\n        except ValueError:\n            # If extension is not recognized, fallback to audio/wav\n            content_type = \"audio/wav\"\n\n    return ProcessedAudioFile(file_content=file_content, filename=filename, content_type=content_type)\n\n\nBARE_ISO_639_1_TO_BCP47: Final = {\n    \"en\": \"en-US\",\n    \"es\": \"es-ES\",","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/litellm_core_utils/audio_utils/utils.py#L92-L128","documentation":"Safety-net guard in process_audio_file: the input passed an earlier isinstance/hasattr check (e.g. an object exposing .read) but reading it yielded no usable content, so the helper raises instead of sending an empty audio payload.","triggerScenarios":"Thrown at litellm/litellm_core_utils/audio_utils/utils.py:110 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the audio file object yields content: bytes are non-empty and file handles are opened in binary read mode.","Verify the file exists and is readable before passing it."],"exampleFix":null,"handlingStrategy":"validation","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-23T08:17:48.524Z"}