{"record":{"id":"3491559123dbf102","repo":"microsoft/semantic-kernel","slug":"the-request-uri-parsed-url-geturl-does-not-c","errorCode":null,"errorMessage":"The request URI '{parsed_url.geturl()}' does not contain a valid host.","messagePattern":"The request URI '(.+?)' does not contain a valid host\\.","errorType":"exception","errorClass":"FunctionExecutionException","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/connectors/openapi_plugin/server_url_validator.py","lineNumber":133,"sourceCode":"        return 80\n    return None\n\n\ndef _matches_path_prefix(url_path: str, base_path: str) -> bool:\n    url_path = url_path or \"/\"\n    base_path = base_path or \"/\"\n\n    if url_path.lower() == base_path.lower():\n        return True\n\n    base_path_with_slash = base_path if base_path.endswith(\"/\") else f\"{base_path}/\"\n    return url_path.lower().startswith(base_path_with_slash.lower())\n\n\nasync def _ensure_public_host(parsed_url: ParseResult, dns_resolver: DnsResolver | None) -> None:\n    host = parsed_url.hostname\n    if host is None:\n        raise FunctionExecutionException(f\"The request URI '{parsed_url.geturl()}' does not contain a valid host.\")\n\n    try:\n        ip_address = ipaddress.ip_address(host)\n    except ValueError:\n        addresses = await _resolve_host(host, dns_resolver)\n    else:\n        _ensure_public_address(parsed_url.geturl(), ip_address)\n        return\n\n    if not addresses:\n        raise FunctionExecutionException(\n            f\"The request URI '{parsed_url.geturl()}' is not allowed: DNS resolution for host \"\n            f\"'{host}' returned no addresses. The request is blocked as a precaution.\"\n        )\n\n    for address in addresses:\n        _ensure_public_address(parsed_url.geturl(), address)\n","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/openapi_plugin/server_url_validator.py#L115-L151","documentation":"Thrown by _ensure_public_host when parsed_url.hostname is None. Because _parse_absolute_url already rejects hostless URLs upstream, this is a defensive invariant guard that is normally unreachable through the public validate_server_url API.","triggerScenarios":"Reached only if an internal caller passes an already-parsed ParseResult that lacks a hostname into _ensure_public_host, bypassing _parse_absolute_url. Not reachable from normal public API usage.","commonSituations":"Defensive/invariant check; signals internal misuse or a library issue rather than a user-configuration problem.","solutions":["Always call the public validate_server_url with a full absolute URL string","If reached through normal API usage, report it as a library issue with the reproducing URL"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    await validate_server_url(url, options)\nexcept FunctionExecutionException as e:\n    if 'does not contain a valid host' in str(e):\n        # this is normally unreachable; ensure you pass a full absolute URL string\n        ...","preventionTips":["Always call the public validate_server_url with a full absolute URL string","Do not invoke private helpers (_ensure_public_host) directly"],"tags":["url-validation","defensive","openapi"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}