xtekky/gpt4free · error · UnsupportedFormatException
Could not convert stream to Markdown. No converter attempted
Error message
Could not convert stream to Markdown. No converter attempted a conversion, suggesting that the filetype is simply not supported.
What it means
Thrown by MarkItDown's MarkItDown.convert() (vendored in g4f/integration/markitdown) as UnsupportedFormatException when it iterates every registered converter and none accepts the input stream — no converter even attempted conversion. It distinguishes this from FileConversionException (raised when converters tried and failed): here the file type is simply unrecognized.
Source
Thrown at g4f/integration/markitdown/__init__.py:125
if res is not None:
if isinstance(res.text_content, str):
# Normalize the content
res.text_content = "\n".join(
[
line.rstrip()
for line in re.split(r"\r?\n", res.text_content)
]
)
res.text_content = re.sub(r"\n{3,}", "\n\n", res.text_content)
return res
# If we got this far without success, report any exceptions
if len(failed_attempts) > 0:
raise FileConversionException(attempts=failed_attempts)
# Nothing can handle it!
raise UnsupportedFormatException(
f"Could not convert stream to Markdown. No converter attempted a conversion, suggesting that the filetype is simply not supported."
)
def convert_stream(
self,
stream: BinaryIO,
*,
stream_info: Optional[StreamInfo] = None,
file_extension: Optional[str] = None, # Deprecated -- use stream_info
url: Optional[str] = None, # Deprecated -- use stream_info
**kwargs: Any,
) -> DocumentConverterResult:
guesses: List[StreamInfo] = []
# Do we have anything on which to base a guess?
base_guess = None
if stream_info is not None or file_extension is not None or url is not None:
# Start with a non-Null base guessView on GitHub (pinned to 973504e177)
Solutions
- Confirm the file type with `file yourinput` and that its extension matches the content.
- Install the optional converters for the format (e.g. pip install 'markitdown[all]' or the specific extra like pdf/docx) so a converter exists to accept it.
- If the format is genuinely unsupported, convert it externally first (libreoffice --headless --convert-to docx, pandoc, etc.) then re-run.
- If you expect the type to be supported but still see this, check that failed imports of converters are not silently disabling them (inspect the markitdown converters list).
Example fix
// before
result = md.convert("report.dat") # no converter accepts .dat
// after
# convert to a supported container first, then:
result = md.convert("report.docx") Defensive patterns
Strategy: try-catch
Validate before calling
SUPPORTED_HINTS = (".pdf", ".docx", ".pptx", ".xlsx", ".csv", ".html", ".htm", ".txt", ".md", ".xml", ".zip", ".mp3", ".wav")
def probably_convertible(path: str) -> bool:
return os.path.splitext(path)[1].lower() in SUPPORTED_HINTS Try / catch
from markitdown import _markitdown.UnsupportedFormatException
try:
result = md.convert(path)
except Exception as e:
if type(e).__name__ == "UnsupportedFormatException":
logger.info("skipping unsupported file %s", path)
return None
raise Prevention
- Install the optional extras for the formats you accept (markitdown[all]).
- Gate uploads by extension/MIME allowlist before invoking convert().
- Convert exotic formats to docx/pdf/txt upstream.
When it happens
Trigger: Calling convert()/convert_stream() on a file whose (extension, mimetype, content) signature matches no registered converter — e.g. a proprietary binary format, a file with a misleading or missing extension, or an empty/garbage file that defeats detection.
Common situations: Users uploading .bin/.dat/.exe or Office/legacy formats not enabled (converters for docx/pdf/xlsx are optional dependencies); a .pdf handled by a converter that failed to import, leaving no accepting converter; a truncated upload where the magic bytes are missing.
Related errors
- MarkItDown requires media to be provided.
- MarkItDown is not installed. Please install it with `pip ins
- url must not be None
- url must be a non-empty string
- url must start with http:// or https://
AI-assisted analysis of xtekky/gpt4free@973504e177 (2026-08-14).
Data as JSON: /api/errors/70b28324af7a3868.
Report an issue: GitHub.