{"record":{"id":"8bd085d41c738bf6","repo":"ScrapeGraphAI/Scrapegraph-ai","slug":"invalid-proxy-server-format-proxy-server","errorCode":null,"errorMessage":"Invalid proxy server format: {proxy['server']}","messagePattern":"Invalid proxy server format: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"scrapegraphai/utils/proxy_rotation.py","lineNumber":201,"sourceCode":"    \"\"\"If a proxy address conforms to a IPv4 address\"\"\"\n    try:\n        ipaddress.IPv4Address(address)\n        return True\n    except ipaddress.AddressValueError:\n        return False\n\n\ndef parse_or_search_proxy(proxy: Proxy) -> ProxySettings:\n    \"\"\"\n    Parses a proxy configuration or searches for a matching one via broker.\n    \"\"\"\n    assert \"server\" in proxy, \"Missing 'server' field in the proxy configuration.\"\n\n    parsed_url = urlparse(proxy[\"server\"])\n    server_address = parsed_url.hostname\n\n    if server_address is None:\n        raise ValueError(f\"Invalid proxy server format: {proxy['server']}\")\n\n    # Accept both IP addresses and domain names like 'gate.nodemaven.com'\n    if is_ipv4_address(server_address) or re.match(\n        r\"^[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$\", server_address\n    ):\n        return _parse_proxy(proxy)\n\n    assert proxy[\"server\"] == \"broker\", f\"Unknown proxy server type: {proxy['server']}\"\n\n    return _search_proxy(proxy)\n","sourceCodeStart":183,"sourceCodeEnd":212,"githubUrl":"https://github.com/ScrapeGraphAI/Scrapegraph-ai/blob/532dfffbf6ee823a6c9cf8cfedc24a93bf026780/scrapegraphai/utils/proxy_rotation.py#L183-L212","documentation":"ValueError from parse_or_search_proxy: the proxy['server'] URL could not be parsed to a hostname (urlparse(...).hostname is None). The server string must be a URL with a host, e.g. 'http://host:port'.","triggerScenarios":"Passing proxy={'server': '8080'} or {'server': ':8080'} or a scheme-only string — anything without a parseable host part.","commonSituations":"Configuring proxy dicts with just a port, missing scheme/host, or malformed credentials embedded in the URL breaking parsing.","solutions":["Set server to a full URL: 'http://user:pass@host:port' or 'socks5://host:port'","Validate the string with urlparse before building the graph","Use a domain or IPv4 host (both are accepted once parseable)"],"exampleFix":"# before\nconfig = {\"proxy\": {\"server\": \"gate.nodemaven.com\"}}\n# after\nconfig = {\"proxy\": {\"server\": \"http://user:pass@gate.nodemaven.com:8080\"}}","handlingStrategy":"validation","validationCode":"from urllib.parse import urlparse\nh = urlparse(proxy[\"server\"]).hostname\nif not h:\n    raise ValueError(\"proxy server must include scheme://host:port\")","typeGuard":"from urllib.parse import urlparse\n\ndef is_valid_proxy_server(server: str) -> bool:\n    return isinstance(server, str) and urlparse(server).hostname is not None","tryCatchPattern":"try:\n    parsed = parse_or_search_proxy(proxy)\nexcept ValueError as e:\n    raise ValueError(f\"check proxy config: {e}\") from e","preventionTips":["Always include scheme and host: 'http://host:port'","Validate proxy URLs in config loaders","Prefer provider URLs with credentials over bare hostnames"],"tags":["proxy","config","url-parsing"],"backgroundTag":"invalid-url-format","analyzedSha":"532dfffbf6ee823a6c9cf8cfedc24a93bf026780","analyzedAt":"2026-08-28T15:19:38.821Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}