{"record":{"id":"9f331eaf3518ef25","repo":"BerriAI/litellm","slug":"unsupported-audio-file-type-type-audio-file","errorCode":null,"errorMessage":"Unsupported audio_file type: {type(audio_file)}","messagePattern":"Unsupported audio_file type: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/litellm_core_utils/audio_utils/utils.py","lineNumber":107,"sourceCode":"                    file_content = f.read()\n            elif hasattr(content, \"read\"):\n                # File-like object\n                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","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/litellm_core_utils/audio_utils/utils.py#L89-L125","documentation":"Fallback guard at the end of process_audio_file's type dispatch: audio_file matched none of the accepted types (bytes, file handle, Path, tuple), so no file content could be produced for the request.","triggerScenarios":"Thrown at litellm/litellm_core_utils/audio_utils/utils.py:107 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass audio_file as bytes, an open file handle, a (filename, content) tuple, or a pathlib.Path.","Check the type of the value you pass; open local files with open(path,'rb')."],"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"}