{"id":"bb322fb50fad465b","repo":"aio-libs/aiohttp","slug":"url-for-is-not-allowed-for-systemroute","errorCode":null,"errorMessage":".url_for() is not allowed for SystemRoute","messagePattern":"\\.url_for\\(\\) is not allowed for SystemRoute","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"aiohttp/web_urldispatcher.py","lineNumber":893,"sourceCode":"        return self._resource.name\n\n    def url_for(self, *args: str, **kwargs: str) -> URL:\n        \"\"\"Construct url for route with additional params.\"\"\"\n        assert self._resource is not None\n        return self._resource.url_for(*args, **kwargs)\n\n    def get_info(self) -> _InfoDict:\n        assert self._resource is not None\n        return self._resource.get_info()\n\n\nclass SystemRoute(AbstractRoute):\n    def __init__(self, http_exception: HTTPException) -> None:\n        super().__init__(hdrs.METH_ANY, self._handle)\n        self._http_exception = http_exception\n\n    def url_for(self, *args: str, **kwargs: str) -> URL:\n        raise RuntimeError(\".url_for() is not allowed for SystemRoute\")\n\n    @property\n    def name(self) -> str | None:\n        return None\n\n    def get_info(self) -> _InfoDict:\n        return {\"http_exception\": self._http_exception}\n\n    async def _handle(self, request: Request) -> StreamResponse:\n        raise self._http_exception\n\n    @property\n    def status(self) -> int:\n        return self._http_exception.status\n\n    @property\n    def reason(self) -> str:\n        return self._http_exception.reason","sourceCodeStart":875,"sourceCodeEnd":911,"githubUrl":"https://github.com/aio-libs/aiohttp/blob/c0ef574e29109210e96e652771ae4e7b88615fa4/aiohttp/web_urldispatcher.py#L875-L911","documentation":"Error \".url_for() is not allowed for SystemRoute\" thrown in aio-libs/aiohttp.","triggerScenarios":"Thrown at aiohttp/web_urldispatcher.py:893 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}