aio-libs/aiohttp · error · ValueError
Duplicate {name!r}, already handled by {self._named_resource
Error message
Duplicate {name!r}, already handled by {self._named_resources[name]!r} What it means
Error "Duplicate {name!r}, already handled by {self._named_resources[name]!r}" thrown in aio-libs/aiohttp.
Source
Thrown at aiohttp/web_urldispatcher.py:1066
if name is not None:
parts = self.NAME_SPLIT_RE.split(name)
for part in parts:
if keyword.iskeyword(part):
raise ValueError(
f"Incorrect route name {name!r}, "
"python keywords cannot be used "
"for route name"
)
if not part.isidentifier():
raise ValueError(
f"Incorrect route name {name!r}, "
"the name should be a sequence of "
"python identifiers separated "
"by dash, dot or column"
)
if name in self._named_resources:
raise ValueError(
f"Duplicate {name!r}, "
f"already handled by {self._named_resources[name]!r}"
)
self._named_resources[name] = resource
self._resources.append(resource)
if isinstance(resource, MatchedSubAppResource):
# We cannot index match sub-app resources because they have match rules
self._matched_sub_app_resources.append(resource)
else:
self.index_resource(resource)
def _get_resource_index_key(self, resource: AbstractResource) -> str:
"""Return a key to index the resource in the resource index."""
if "{" in (index_key := resource.canonical):
# strip at the first { to allow for variables, and than
# rpartition at / to allow for variable parts in the path
# For example if the canonical path is `/core/locations{tail:.*}`View on GitHub (pinned to c0ef574e29)
When it happens
Trigger: Thrown at aiohttp/web_urldispatcher.py:1066 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/af805677600af67b.json.
Report an issue: GitHub.