BerriAI/litellm · error · ValueError

No supported extensions for MIME type

Error message

No supported extensions for MIME type: {mime_type}. Supported formats: {supported_doc_formats}

What it means

Bedrock document conversion guard: the supplied MIME type maps to no extension among the supported document formats (pdf, csv, doc(x), etc.), so the content block cannot be converted to a Bedrock Converse document block. Fires when a user passes an unsupported document type.

Solutions

  1. Convert the document to one of the supported formats for the model before sending.
  2. Check the MIME type of the file you are passing.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/litellm_core_utils/prompt_templates/factory.py:3516 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/9541fc8e67116ce3. Report an issue: GitHub.

Appendix: 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 data

View on GitHub (pinned to 77b7c6c40c)