{"record":{"id":"818a7884fcef2d58","repo":"BerriAI/litellm","slug":"process-audio-file-does-not-accept-bare-str-inputs","errorCode":null,"errorMessage":"process_audio_file does not accept bare str inputs. Pass bytes, an open file handle, a (filename, content) tuple, or a pathlib.Path.","messagePattern":"process_audio_file does not accept bare str inputs\\. Pass bytes, an open file handle, a \\(filename, content\\) tuple, or a pathlib\\.Path\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/litellm_core_utils/audio_utils/utils.py","lineNumber":61,"sourceCode":"    Returns:\n        ProcessedAudioFile: Structured data with file content, filename, and content type\n\n    Raises:\n        ValueError: If audio_file type is unsupported or content cannot be extracted\n    \"\"\"\n    file_content = None\n    filename = None\n\n    if isinstance(audio_file, (bytes, bytearray)):\n        # Raw bytes\n        filename = \"audio.wav\"\n        file_content = bytes(audio_file)\n    elif isinstance(audio_file, str):\n        # Bare strings are rejected — see extract_file_data for the same\n        # rationale: in a proxy request handler the string is\n        # attacker-controlled, and opening it as a path is an arbitrary\n        # file read.\n        raise ValueError(\n            \"process_audio_file does not accept bare str inputs. Pass bytes, \"\n            \"an open file handle, a (filename, content) tuple, or a \"\n            \"pathlib.Path.\"\n        )\n    elif isinstance(audio_file, os.PathLike):\n        # File path or PathLike — PathLike is a Python-level type that\n        # HTTP form values can't fabricate.\n        file_path: Final = str(audio_file)\n        with open(file_path, \"rb\") as f:\n            file_content = f.read()\n        filename = file_path.split(\"/\")[-1]\n    elif isinstance(audio_file, tuple):\n        # Tuple format: (filename, content, content_type) or (filename, content)\n        if len(audio_file) >= 2:\n            filename = audio_file[0] or \"audio.wav\"\n            content: Final = audio_file[1]\n            if isinstance(content, (bytes, bytearray)):\n                file_content = bytes(content)","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/litellm_core_utils/audio_utils/utils.py#L43-L79","documentation":"Error \"process_audio_file does not accept bare str inputs. Pass bytes, an open file handle, a (filename, content) tuple, or a pathlib.Path.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/litellm_core_utils/audio_utils/utils.py:61 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass bytes, an open file handle, a (filename, content) tuple, or a pathlib.Path instead of a bare string path."],"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-15T17:31:12.345Z"}