{"record":{"id":"1b9f3fbf81690152","repo":"vllm-project/vllm","slug":"invalid-http-url-a-valid-http-url-must-have-schem","errorCode":null,"errorMessage":"Invalid HTTP URL: A valid HTTP URL must have scheme 'http' or 'https'.","messagePattern":"Invalid HTTP URL: A valid HTTP URL must have scheme 'http' or 'https'\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"vllm/connections.py","lineNumber":229,"sourceCode":"    def get_sync_client(self) -> requests.Session:\n        if self._sync_client is None or not self.reuse_client:\n            self._sync_client = requests.Session()\n\n        return self._sync_client\n\n    # NOTE: We intentionally use an async function even though it is not\n    # required, so that the client is only accessible inside async event loop\n    async def get_async_client(self) -> aiohttp.ClientSession:\n        if self._async_client is None or not self.reuse_client:\n            self._async_client = aiohttp.ClientSession(trust_env=True)\n\n        return self._async_client\n\n    def _validate_http_url(self, url: str):\n        parsed_url = parse_url(url)\n\n        if parsed_url.scheme not in (\"http\", \"https\"):\n            raise ValueError(\n                \"Invalid HTTP URL: A valid HTTP URL must have scheme 'http' or 'https'.\"\n            )\n\n    def _headers(self, **extras: str) -> MutableMapping[str, str]:\n        return {\"User-Agent\": f\"vLLM/{VLLM_VERSION}\", **extras}\n\n    def get_response(\n        self,\n        url: str,\n        *,\n        stream: bool = False,\n        timeout: float | None = None,\n        extra_headers: Mapping[str, str] | None = None,\n        allow_redirects: bool = True,\n    ):\n        self._validate_http_url(url)\n\n        client = self.get_sync_client()","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/vllm/connections.py#L211-L247","documentation":"Raised by HTTPConnection._validate_http_url (vllm/connections.py) when a URL passed to the client parses with a scheme other than http or https. vLLM validates URLs before issuing requests (model downloads, API calls) so misconfigured endpoints fail fast instead of producing confusing downstream errors.","triggerScenarios":"Passing a URL with a scheme like ftp://, file://, s3://, hf://, or a bare host without a scheme to any HTTPConnection method that calls _validate_http_url (e.g. get_response on the shared async client).","commonSituations":"Setting an environment variable or CLI flag for a model/metrics/API endpoint to a non-HTTP URI; forgetting the https:// prefix on a host; pointing a download URL at an object-store or HF URI instead of its HTTP endpoint.","solutions":["Add or correct the scheme so the URL starts with http:// or https://.","If the resource lives on HuggingFace or S3, use the HTTP endpoint URL (or the dedicated HF download path) rather than the native scheme.","Check for stray whitespace or a leading path fragment before the scheme in the URL string."],"exampleFix":"# before\nclient.get_response(\"hf.co/Nemotron/weights.bin\")\n# after\nclient.get_response(\"https://hf.co/Nemotron/weights.bin\")","handlingStrategy":"validation","validationCode":"from urllib.parse import urlparse\n\ndef is_http_url(url: str) -> bool:\n    return urlparse(url).scheme in (\"http\", \"https\")\n\nassert is_http_url(os.environ[\"VLLM_DOWNLOAD_URL\"])","typeGuard":"def is_http_url(url: str) -> bool:\n    return urlparse(url).scheme in (\"http\", \"https\")","tryCatchPattern":"try:\n    resp = await client.get_response(url)\nexcept ValueError as e:\n    if \"scheme\" in str(e):\n        url = \"https://\" + url.lstrip(\"/\")  # repair only if clearly a bare host\n    raise","preventionTips":["Validate endpoint URLs at config load time with urlparse, not at request time.","Centralize URL construction in one helper that always injects the scheme."],"tags":["vllm","url","validation","network","config"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}