{"record":{"id":"4946f9b8dec6c5be","repo":"microsoft/markitdown","slug":"unsupported-uri-scheme-uri-split-0-suppo","errorCode":null,"errorMessage":"Unsupported URI scheme: {uri.split(':')[0]}. Supported schemes are: file:, data:, http:, https:","messagePattern":"Unsupported URI scheme: (.+?)\\. Supported schemes are: file:, data:, http:, https:","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"packages/markitdown/src/markitdown/_markitdown.py","lineNumber":485,"sourceCode":"                io.BytesIO(data),\n                stream_info=base_guess,\n                file_extension=file_extension,\n                url=mock_url,\n                **kwargs,\n            )\n        # HTTP/HTTPS URIs\n        elif uri.startswith(\"http:\") or uri.startswith(\"https:\"):\n            response = self._requests_session.get(uri, stream=True)\n            response.raise_for_status()\n            return self.convert_response(\n                response,\n                stream_info=stream_info,\n                file_extension=file_extension,\n                url=mock_url,\n                **kwargs,\n            )\n        else:\n            raise ValueError(\n                f\"Unsupported URI scheme: {uri.split(':')[0]}. Supported schemes are: file:, data:, http:, https:\"\n            )\n\n    def convert_response(\n        self,\n        response: requests.Response,\n        *,\n        stream_info: Optional[StreamInfo] = None,\n        file_extension: Optional[str] = None,  # Deprecated -- use stream_info\n        url: Optional[str] = None,  # Deprecated -- use stream_info\n        **kwargs: Any,\n    ) -> DocumentConverterResult:\n        # If there is a content-type header, get the mimetype and charset (if present)\n        mimetype: Optional[str] = None\n        charset: Optional[str] = None\n\n        if \"content-type\" in response.headers:\n            parts = response.headers[\"content-type\"].split(\";\")","sourceCodeStart":467,"sourceCodeEnd":503,"githubUrl":"https://github.com/microsoft/markitdown/blob/fd239d5d2be43d9b68329730206b9312c7d5a388/packages/markitdown/src/markitdown/_markitdown.py#L467-L503","documentation":"convert_uri() only handles four schemes: file:, data:, http:, https:. Any other scheme falls through to a ValueError that echoes the scheme prefix (everything before the first colon). This is a fast-fail guard so unsupported protocols (ftp:, s3:, mailto:, blob:) never reach network or filesystem code.","triggerScenarios":"md.convert_uri('ftp://host/file.pdf'), md.convert_uri('s3://bucket/key.docx'), md.convert_uri('mailto:a@b.com'), or a relative string without any scheme (split(':')[0] then yields the whole first token).","commonSituations":"Passing cloud-storage URIs (s3://, gs://, abfs://) or Windows drive paths ('C:\\file.docx', where 'C' is reported as the scheme) instead of local paths or HTTP URLs.","solutions":["Download non-HTTP resources first, then pass the local path or a BytesIO stream","For Windows paths, pass them as plain paths to convert(), not to convert_uri()","Prefix valid web URIs with http:// or https:// explicitly"],"exampleFix":"# before\nmd.convert_uri(\"s3://bucket/doc.pdf\")  # ValueError: Unsupported URI scheme: s3\n\n# after\nimport boto3, io\nbody = boto3.client(\"s3\").get_object(Bucket=\"bucket\", Key=\"doc.pdf\")[\"Body\"].read()\nmd.convert(io.BytesIO(body), stream_info=StreamInfo(extension=\".pdf\", mimetype=\"application/pdf\"))","handlingStrategy":"validation","validationCode":"SUPPORTED_SCHEMES = (\"file:\", \"data:\", \"http:\", \"https:\")\n\ndef is_supported_uri(uri: str) -> bool:\n    return uri.startswith(SUPPORTED_SCHEMES)","typeGuard":null,"tryCatchPattern":"try:\n    result = md.convert_uri(uri)\nexcept ValueError as e:\n    if \"Unsupported URI scheme\" in str(e):\n        # fetch via the right client, then convert the bytes\n        raise\n    raise","preventionTips":["Whitelist schemes at input validation time: file, data, http, https","Convert cloud URIs (s3://, gs://) to local paths or streams before calling markitdown","Never pass Windows drive-letter paths to convert_uri(); use convert() instead"],"tags":["uri","scheme","validation"],"backgroundTag":null,"analyzedSha":"fd239d5d2be43d9b68329730206b9312c7d5a388","analyzedAt":"2026-08-14T15:47:51.745Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}