{"record":{"id":"499f3a16dc96f6b7","repo":"BerriAI/litellm","slug":"unknown-extension-for-mime-type-mime-type","errorCode":null,"errorMessage":"Unknown extension for mime type: {mime_type}","messagePattern":"Unknown extension for mime type: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/types/files.py","lineNumber":161,"sourceCode":"        FileType.WAV: \"audio/wav\",\n        FileType.WEBM: \"video/webm\",\n        FileType.WEBP: \"image/webp\",\n        FileType.WMV: \"video/wmv\",\n        FileType.XLS: \"application/vnd.ms-excel\",\n        FileType.XLSX: \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\",\n    }\n)\n\n\"\"\"\nUtil Functions\n\"\"\"\n\n\ndef get_file_extension_from_mime_type(mime_type: str) -> str:\n    for file_type, mime in FILE_MIME_TYPES.items():\n        if mime.lower() == mime_type.lower():\n            return FILE_EXTENSIONS[file_type][0]\n    raise ValueError(f\"Unknown extension for mime type: {mime_type}\")\n\n\ndef get_file_type_from_extension(extension: str) -> FileType:\n    for file_type, extensions in FILE_EXTENSIONS.items():\n        if extension.lower() in extensions:\n            return file_type\n\n    raise ValueError(f\"Unknown file type for extension: {extension}\")\n\n\ndef get_file_extension_for_file_type(file_type: FileType) -> str:\n    return FILE_EXTENSIONS[file_type][0]\n\n\ndef get_file_mime_type_for_file_type(file_type: FileType) -> str:\n    return FILE_MIME_TYPES[file_type]\n\n","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/types/files.py#L143-L179","documentation":"Reverse-lookup failure in get_file_extension_from_mime_type: the supplied MIME type string does not match any entry in the FILE_MIME_TYPES mapping, so no canonical file extension exists for it. The mime_type argument is the invalid input.","triggerScenarios":"Thrown at litellm/types/files.py:161 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a recognized MIME type (e.g. application/pdf, text/plain) or add a mapping for {mime_type}.","Pass an explicit file extension instead of relying on MIME type inference."],"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-14T05:17:10.506Z"}