{"record":{"id":"078ba0c277008855","repo":"roboflow/supervision","slug":"unsupported-url-scheme-parsed-url-scheme-in-url","errorCode":null,"errorMessage":"Unsupported URL scheme {parsed_url.scheme} in {url}. Only HTTP and HTTPS URLs are supported.","messagePattern":"Unsupported URL scheme (.+?) in (.+?)\\. Only HTTP and HTTPS URLs are supported\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/supervision/utils/file.py","lineNumber":44,"sourceCode":"    Raises:\n        ValueError: If the URL is invalid or uses an unsupported scheme.\n    \"\"\"\n    try:\n        original_parsed_url = urllib.parse.urlparse(url)\n        if \"\\\\\" in original_parsed_url.netloc:\n            raise ValueError(\"URL authority contains a backslash\")\n\n        prepared_request = requests.Request(method=\"GET\", url=url).prepare()\n        prepared_url = prepared_request.url\n        if prepared_url is None:\n            raise ValueError(\"prepared URL is empty\")\n\n        parsed_url = urllib.parse.urlparse(prepared_url)\n    except (requests.RequestException, ValueError) as error:\n        raise ValueError(f\"Invalid URL {url!r}: {error}\") from error\n\n    if parsed_url.scheme not in {\"http\", \"https\"}:\n        raise ValueError(\n            f\"Unsupported URL scheme {parsed_url.scheme!r} in {url!r}. \"\n            \"Only HTTP and HTTPS URLs are supported.\"\n        )\n    if parsed_url.hostname is None:\n        raise ValueError(f\"Invalid URL {url!r}: no host supplied.\")\n\n    return prepared_url\n\n\ndef _download_to_file(\n    url: str, target: Path, *, timeout: float = 30.0, stream: bool = False\n) -> None:\n    \"\"\"\n    Download `url` to `target` atomically using a temporary file and `os.replace`.\n\n    Args:\n        url: HTTP(S) URL to download.\n        target: Destination file path. Parent directories are created as needed.","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/roboflow/supervision/blob/7f254d9784d4c37e0f03cd89ddee164c8db099c0/src/supervision/utils/file.py#L26-L62","documentation":"Raised during URL validation (e.g. for downloading assets) when the parsed URL scheme is not http or https. The validator explicitly allows only these two schemes, so ftp://, file://, gs://, s3://, or scheme-less strings are rejected even though `requests` might partially accept them. This is a security and capability boundary: the downloader only speaks HTTP(S).","triggerScenarios":"Passing `'ftp://host/file.zip'`, `'file:///data/model.pt'`, or `'s3://bucket/key'` to a supervision download API; a config value without a scheme that parses to something unexpected.","commonSituations":"Porting configs from tools that accept cloud-storage URIs; local-development overrides pointing at files on disk; copy-pasting mirror URLs (e.g. an internal Artifactory ftp mirror).","solutions":["Use http:// or https:// URLs only.","For local files, call the local-path code path (pass a Path) instead of the URL downloader.","For cloud storage, download with the native SDK first, then pass the local file."],"exampleFix":"# before\nurl = 's3://my-bucket/model.pt'\n# after\n# download via aws cli / boto3 to './model.pt', then pass the local path","handlingStrategy":"validation","validationCode":"from urllib.parse import urlparse\nscheme = urlparse(url).scheme\nassert scheme in {'http', 'https'}, f'unsupported scheme: {scheme!r}'","typeGuard":"def is_http_url(url: str) -> bool:\n    return urlparse(url).scheme in {'http', 'https'}","tryCatchPattern":null,"preventionTips":["Reject non-http(s) URIs at config load time.","Use the local-path API for files on disk.","Download cloud-storage objects with their native SDK first."],"tags":["url","download","validation","scheme"],"backgroundTag":null,"analyzedSha":"7f254d9784d4c37e0f03cd89ddee164c8db099c0","analyzedAt":"2026-08-15T05:13:01.950Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}