{"record":{"id":"10ea3ad058a81cc9","repo":"microsoft/markitdown","slug":"unsupported-file-type-for-content-understanding-co","errorCode":null,"errorMessage":"Unsupported file type for Content Understanding conversion.","messagePattern":"Unsupported file type for Content Understanding conversion\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"packages/markitdown/src/markitdown/converters/_cu_converter.py","lineNumber":536,"sourceCode":"        file_stream: BinaryIO,\n        stream_info: StreamInfo,\n        **kwargs: Any,\n    ) -> bool:\n        \"\"\"Return True if the file type is in the configured set.\"\"\"\n        return _detect_file_type(stream_info, self._file_types) is not None\n\n    def convert(\n        self,\n        file_stream: BinaryIO,\n        stream_info: StreamInfo,\n        **kwargs: Any,\n    ) -> DocumentConverterResult:\n        \"\"\"Convert the file using CU and return Markdown with YAML front matter.\"\"\"\n\n        # 1. Determine analyzer_id (smart routing: check modality)\n        file_type = _detect_file_type(stream_info, self._file_types)\n        if file_type is None:\n            raise ValueError(\n                \"Unsupported file type for Content Understanding conversion.\"\n            )\n        file_modality = _get_modality(file_type)\n\n        if (\n            self._analyzer_id is not None\n            and self._analyzer_modality is not None\n            and _is_analyzer_compatible(file_modality, self._analyzer_modality)\n        ):\n            analyzer_id = self._analyzer_id\n        else:\n            analyzer_id = _PREBUILT_ANALYZERS.get(\n                file_modality, \"prebuilt-documentSearch\"\n            )\n\n        # 2. Read file bytes and determine MIME type\n        file_bytes = file_stream.read()\n        content_type = _content_type_for(file_type, stream_info.mimetype)","sourceCodeStart":518,"sourceCodeEnd":554,"githubUrl":"https://github.com/microsoft/markitdown/blob/fd239d5d2be43d9b68329730206b9312c7d5a388/packages/markitdown/src/markitdown/converters/_cu_converter.py#L518-L554","documentation":"ContentUnderstandingConverter.convert() starts by detecting the file type from stream_info via _detect_file_type(), which maps a lowercase extension (or MIME type) through _EXTENSION_MAP, filtered by the converter's file_types set. A None result — no mapping or excluded by file_types — raises this ValueError before any Azure call is made. Note accepts() normally prevents reaching convert() with unsupported types, so this guard fires mainly when converters are invoked directly or registrations are customized.","triggerScenarios":"Calling cu_converter.convert(stream, StreamInfo(extension='.xyz')) directly, passing a supported extension that was excluded via the file_types constructor argument, or a stream_info with neither extension nor a recognized mimetype.","commonSituations":"Constructing ContentUnderstandingConverter(file_types=[...]) too narrowly, direct converter invocation in tests/batches bypassing MarkItDown's dispatch, or files with missing/incorrect extensions.","solutions":["Pass explicit stream_info with a supported extension/mimetype (e.g. StreamInfo(extension='.pdf', mimetype='application/pdf'))","Widen or omit the file_types argument so the default full set applies","Rename/pre-convert files whose extension does not reflect content","Route through md.convert()/md.convert_stream() so accepts() filtering happens first"],"exampleFix":"# before\nconv = ContentUnderstandingConverter(file_types=[ContentUnderstandingFileType.DOCX])\nconv.convert(s, StreamInfo(extension=\".pdf\"))  # ValueError\n\n# after\nconv = ContentUnderstandingConverter()  # default: all supported types\nconv.convert(s, StreamInfo(extension=\".pdf\", mimetype=\"application/pdf\"))","handlingStrategy":"validation","validationCode":"from markitdown.converters._cu_converter import _EXTENSION_MAP\n\ndef cu_supports(stream_info) -> bool:\n    ext = (stream_info.extension or \"\").lower()\n    return ext in _EXTENSION_MAP","typeGuard":null,"tryCatchPattern":"try:\n    result = cu_converter.convert(stream, stream_info)\nexcept ValueError as e:\n    if \"Unsupported file type\" in str(e):\n        log.info(\"CU cannot handle %s; routing to default converters\", stream_info.extension)\n        result = md.convert(stream, stream_info=stream_info)\n    else:\n        raise","preventionTips":["Route files through MarkItDown.dispatch so accepts() filters unsupported types before convert()","When narrowing file_types, document the resulting accepted extensions and enforce them upstream","Always supply both extension and mimetype in StreamInfo for in-memory streams"],"tags":["azure","content-understanding","unsupported-format","stream-info"],"backgroundTag":null,"analyzedSha":"fd239d5d2be43d9b68329730206b9312c7d5a388","analyzedAt":"2026-08-14T15:47:51.745Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}