aio-libs/aiohttp · error · ValueError
Domain not valid
Error message
Domain not valid
What it means
Error "Domain not valid" thrown in aio-libs/aiohttp.
Source
Thrown at aiohttp/web_urldispatcher.py:790
super().__init__()
self._domain = self.validation(domain)
@property
def canonical(self) -> str:
return self._domain
def validation(self, domain: str) -> str:
if not isinstance(domain, str):
raise TypeError("Domain must be str")
domain = domain.rstrip(".").lower()
if not domain:
raise ValueError("Domain cannot be empty")
elif "://" in domain:
raise ValueError("Scheme not supported")
url = URL("http://" + domain)
assert url.raw_host is not None
if not all(self.re_part.fullmatch(x) for x in url.raw_host.split(".")):
raise ValueError("Domain not valid")
if url.port == 80:
return url.raw_host
return f"{url.raw_host}:{url.port}"
async def match(self, request: Request) -> bool:
host = request.headers.get(hdrs.HOST)
if not host:
return False
return self.match_domain(host)
def match_domain(self, host: str) -> bool:
return host.lower() == self._domain
def get_info(self) -> _InfoDict:
return {"domain": self._domain}
class MaskDomain(Domain):View on GitHub (pinned to c0ef574e29)
When it happens
Trigger: Thrown at aiohttp/web_urldispatcher.py:790 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of aio-libs/aiohttp@c0ef574e29 (2026-08-04).
Data as JSON: /data/errors/d69f2c035646e067.json.
Report an issue: GitHub.