{"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/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/litellm_core_utils/audio_utils/utils.py#L92-L128","documentation":"Error \"Could not extract file content from audio_file\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/litellm_core_utils/audio_utils/utils.py:110 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide readable audio content (bytes or open file) so file content can be extracted."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}