BerriAI/litellm · error · ValueError
process_audio_file does not accept bare str inputs. Pass byt
Error message
process_audio_file does not accept bare str inputs. Pass bytes, an open file handle, a (filename, content) tuple, or a pathlib.Path.
What it means
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.
Source
Thrown at litellm/litellm_core_utils/audio_utils/utils.py:61
Returns:
ProcessedAudioFile: Structured data with file content, filename, and content type
Raises:
ValueError: If audio_file type is unsupported or content cannot be extracted
"""
file_content = None
filename = None
if isinstance(audio_file, (bytes, bytearray)):
# Raw bytes
filename = "audio.wav"
file_content = bytes(audio_file)
elif isinstance(audio_file, str):
# Bare strings are rejected — see extract_file_data for the same
# rationale: in a proxy request handler the string is
# attacker-controlled, and opening it as a path is an arbitrary
# file read.
raise ValueError(
"process_audio_file does not accept bare str inputs. Pass bytes, "
"an open file handle, a (filename, content) tuple, or a "
"pathlib.Path."
)
elif isinstance(audio_file, os.PathLike):
# File path or PathLike — PathLike is a Python-level type that
# HTTP form values can't fabricate.
file_path: Final = str(audio_file)
with open(file_path, "rb") as f:
file_content = f.read()
filename = file_path.split("/")[-1]
elif isinstance(audio_file, tuple):
# Tuple format: (filename, content, content_type) or (filename, content)
if len(audio_file) >= 2:
filename = audio_file[0] or "audio.wav"
content: Final = audio_file[1]
if isinstance(content, (bytes, bytearray)):
file_content = bytes(content)View on GitHub (pinned to 6c2dcb801b)
Solutions
- Pass bytes, an open file handle, a (filename, content) tuple, or a pathlib.Path instead of a bare string path.
When it happens
Trigger: Thrown at litellm/litellm_core_utils/audio_utils/utils.py:61 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/818a7884fcef2d58.
Report an issue: GitHub.