BerriAI/litellm · error · ValueError
No supported extensions for MIME type: {mime_type}. Supporte
Error message
No supported extensions for MIME type: {mime_type}. Supported formats: {supported_doc_formats} What it means
Bedrock document handling: given a mime_type, LiteLLM tries mimetypes.guess_all_extensions and falls back to its own mime-to-extension table, keeping only extensions in the supported document formats list. If both yield nothing usable, this ValueError is raised — the document's MIME type has no Bedrock-supported extension.
Source
Thrown at litellm/litellm_core_utils/prompt_templates/factory.py:3516
potential_extensions: Final = mimetypes.guess_all_extensions(mime_type, strict=False)
valid_extensions = [ext[1:] for ext in potential_extensions if ext[1:] in supported_doc_formats]
# Fallback to types/files.py if mimetypes doesn't return valid extensions
#################
# litellm runs on docker containers and `mimetypes` depends on the installed mimetypes of the OS
# we fallback to well known mime types in types/files.py if mimetypes doesn't return valid extensions
if not valid_extensions:
try:
fallback_extension: Final = get_file_extension_from_mime_type(mime_type)
if fallback_extension in supported_doc_formats:
valid_extensions = [fallback_extension]
except ValueError:
# Neither mimetypes nor files.py could handle this MIME type
# get_file_extension_from_mime_type raises ValueError if the mime type is not supported
pass
if not valid_extensions:
raise ValueError(
f"No supported extensions for MIME type: {mime_type}. Supported formats: {supported_doc_formats}"
)
# Use first valid extension instead of provided image_format
return valid_extensions[0]
@staticmethod
def _create_bedrock_block(image_bytes: str, mime_type: str, image_format: str) -> BedrockContentBlock:
"""Create appropriate Bedrock content block based on mime type."""
_blob: Final = BedrockSourceBlock(bytes=image_bytes)
document_types: Final = ["application", "text"]
is_document: Final = any(mime_type.startswith(doc_type) for doc_type in document_types)
supported_video_formats: Final = litellm.AmazonConverseConfig().get_supported_video_types()
is_video: Final = any(image_format.startswith(video_type) for video_type in supported_video_formats)
HASH_SAMPLE_BYTES: Final = 64 * 1024 # hash up to 64 KB of dataView on GitHub (pinned to 6c2dcb801b)
Solutions
- Convert the document to a supported type (typically PDF or plain text) before sending
- Fix the mime_type/extension on the file so it maps to a supported document format (check the error's supported list)
- For data files, extract the text and send it as text content instead of a document block
Example fix
# before
block = {"type": "file", "file": {"filename": "data.zip", "file_data": "data:application/zip;base64,<b64>"}}
# after: convert content to PDF/text first
import subprocess
subprocess.run(["libreoffice", "--headless", "--convert-to", "pdf", "report.doc"], check=True)
block = {"type": "file", "file": {"filename": "report.pdf", "file_data": "data:application/pdf;base64,<b64>"}} Defensive patterns
Strategy: validation
Validate before calling
import mimetypes
SUPPORTED_DOC_EXTENSIONS = {"pdf", "doc", "docx", "xls", "xlsx", "csv", "md", "txt"} # align with error's list
def validate_bedrock_document(filename: str, mime_type: str) -> None:
exts = {e.lstrip(".").lower() for e in mimetypes.guess_all_extensions(mime_type)}
if not (exts & SUPPORTED_DOC_EXTENSIONS):
raise ValueError(f"convert {mime_type} to a supported document type (e.g. PDF) before sending") Prevention
- Convert documents to PDF before sending to Bedrock
- Keep filenames/extensions aligned with real content types
- Send tabular data as text instead of a document block
When it happens
Trigger: Sending a document with an unsupported mime type (e.g. application/x-zip-compressed, application/msword legacy, text/csv variants, proprietary types) to a Bedrock model via the document path; mislabelled content-type on stored files.
Common situations: Uploading DOC/XLS/ZIP/etc. files when only PDF/DOCX/TXT/MD-style document types are supported; files whose extension was stripped so only a weird mime header remains; CSV/TSV sent where a text/* type is accepted only for specific extensions.
Related errors
- Unsupported image format: {image_format}. Supported formats:
- Invalid guardrailConfig={raw_guardrail_config}. Expected for
- guardrailConfig={raw_guardrail_config} is missing 'guardrail
- Invalid S3 URI format: {s3_uri}
- model parameter is required
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/9541fc8e67116ce3.
Report an issue: GitHub.