{"id":"af805677600af67b","repo":"aio-libs/aiohttp","slug":"duplicate-name-r-already-handled-by-self-name","errorCode":null,"errorMessage":"Duplicate {name!r}, already handled by {self._named_resources[name]!r}","messagePattern":"Duplicate (.+?), already handled by (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"aiohttp/web_urldispatcher.py","lineNumber":1066,"sourceCode":"\n        if name is not None:\n            parts = self.NAME_SPLIT_RE.split(name)\n            for part in parts:\n                if keyword.iskeyword(part):\n                    raise ValueError(\n                        f\"Incorrect route name {name!r}, \"\n                        \"python keywords cannot be used \"\n                        \"for route name\"\n                    )\n                if not part.isidentifier():\n                    raise ValueError(\n                        f\"Incorrect route name {name!r}, \"\n                        \"the name should be a sequence of \"\n                        \"python identifiers separated \"\n                        \"by dash, dot or column\"\n                    )\n            if name in self._named_resources:\n                raise ValueError(\n                    f\"Duplicate {name!r}, \"\n                    f\"already handled by {self._named_resources[name]!r}\"\n                )\n            self._named_resources[name] = resource\n        self._resources.append(resource)\n\n        if isinstance(resource, MatchedSubAppResource):\n            # We cannot index match sub-app resources because they have match rules\n            self._matched_sub_app_resources.append(resource)\n        else:\n            self.index_resource(resource)\n\n    def _get_resource_index_key(self, resource: AbstractResource) -> str:\n        \"\"\"Return a key to index the resource in the resource index.\"\"\"\n        if \"{\" in (index_key := resource.canonical):\n            # strip at the first { to allow for variables, and than\n            # rpartition at / to allow for variable parts in the path\n            # For example if the canonical path is `/core/locations{tail:.*}`","sourceCodeStart":1048,"sourceCodeEnd":1084,"githubUrl":"https://github.com/aio-libs/aiohttp/blob/c0ef574e29109210e96e652771ae4e7b88615fa4/aiohttp/web_urldispatcher.py#L1048-L1084","documentation":"Error \"Duplicate {name!r}, already handled by {self._named_resources[name]!r}\" thrown in aio-libs/aiohttp.","triggerScenarios":"Thrown at aiohttp/web_urldispatcher.py:1066 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"c0ef574e29109210e96e652771ae4e7b88615fa4","analyzedAt":"2026-08-04T19:51:05.467Z","schemaVersion":2}