{"record":{"id":"d346074dde7bb739","repo":"BerriAI/litellm","slug":"process-audio-file-does-not-accept-bare-str-tuple","errorCode":null,"errorMessage":"process_audio_file does not accept bare str tuple contents. Pass bytes, an open file handle, or a pathlib.Path.","messagePattern":"process_audio_file does not accept bare str tuple contents\\. Pass bytes, an open file handle, or a pathlib\\.Path\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/litellm_core_utils/audio_utils/utils.py","lineNumber":81,"sourceCode":"            \"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)\n            elif isinstance(content, str):\n                raise ValueError(\n                    \"process_audio_file does not accept bare str tuple \"\n                    \"contents. Pass bytes, an open file handle, or a \"\n                    \"pathlib.Path.\"\n                )\n            elif isinstance(content, os.PathLike):\n                # PathLike: SDK convenience for local-file uploads.\n                with open(str(content), \"rb\") as f:\n                    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)):","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/litellm_core_utils/audio_utils/utils.py#L63-L99","documentation":"Error \"process_audio_file does not accept bare str tuple contents. Pass bytes, an open file handle, or a pathlib.Path.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/litellm_core_utils/audio_utils/utils.py:81 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass bytes, an open file handle, or a pathlib.Path inside the tuple instead of a string."],"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"}