microsoft/semantic-kernel · error · FunctionExecutionException
The request URI '{parsed_url.geturl()}' does not contain a v
Error message
The request URI '{parsed_url.geturl()}' does not contain a valid host. What it means
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.
Source
Thrown at python/semantic_kernel/connectors/openapi_plugin/server_url_validator.py:133
return 80
return None
def _matches_path_prefix(url_path: str, base_path: str) -> bool:
url_path = url_path or "/"
base_path = base_path or "/"
if url_path.lower() == base_path.lower():
return True
base_path_with_slash = base_path if base_path.endswith("/") else f"{base_path}/"
return url_path.lower().startswith(base_path_with_slash.lower())
async def _ensure_public_host(parsed_url: ParseResult, dns_resolver: DnsResolver | None) -> None:
host = parsed_url.hostname
if host is None:
raise FunctionExecutionException(f"The request URI '{parsed_url.geturl()}' does not contain a valid host.")
try:
ip_address = ipaddress.ip_address(host)
except ValueError:
addresses = await _resolve_host(host, dns_resolver)
else:
_ensure_public_address(parsed_url.geturl(), ip_address)
return
if not addresses:
raise FunctionExecutionException(
f"The request URI '{parsed_url.geturl()}' is not allowed: DNS resolution for host "
f"'{host}' returned no addresses. The request is blocked as a precaution."
)
for address in addresses:
_ensure_public_address(parsed_url.geturl(), address)
View on GitHub (pinned to c028a0c7dc)
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
Defensive patterns
Strategy: try-catch
Try / catch
try:
await validate_server_url(url, options)
except FunctionExecutionException as e:
if 'does not contain a valid host' in str(e):
# this is normally unreachable; ensure you pass a full absolute URL string
... Prevention
- Always call the public validate_server_url with a full absolute URL string
- Do not invoke private helpers (_ensure_public_host) directly
When it happens
Trigger: 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.
Common situations: Defensive/invariant check; signals internal misuse or a library issue rather than a user-configuration problem.
Related errors
- The request URI '{url}' is not allowed. It does not match an
- The request URI scheme '{parsed_url.scheme}' is not allowed.
- Invalid {option_name}: {url}
- AZURE_OPENAI_ENDPOINT is not set.
- Configuration is not provided.
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/3491559123dbf102.
Report an issue: GitHub.