{"id":"d60b8fd9b206e468","repo":"aio-libs/aiohttp","slug":"cannot-connect-to-unix-socket-path-ssl-ssl-s","errorCode":null,"errorMessage":"Cannot connect to unix socket {path} ssl:{ssl} [{strerror}]","messagePattern":"Cannot connect to unix socket (.+?) ssl:(.+?) \\[(.+?)\\]","errorType":"exception","errorClass":"UnixClientConnectorError","httpStatus":null,"severity":"error","filePath":"aiohttp/connector.py","lineNumber":1716,"sourceCode":"    @property\n    def path(self) -> str:\n        \"\"\"Path to unix socket.\"\"\"\n        return self._path\n\n    async def _create_connection(\n        self, req: ClientRequest, traces: list[\"Trace\"], timeout: \"ClientTimeout\"\n    ) -> ResponseHandler:\n        try:\n            async with ceil_timeout(\n                timeout.sock_connect, ceil_threshold=timeout.ceil_threshold\n            ):\n                _, proto = await self._loop.create_unix_connection(\n                    self._factory, self._path\n                )\n        except OSError as exc:\n            if exc.errno is None and isinstance(exc, asyncio.TimeoutError):\n                raise\n            raise UnixClientConnectorError(self.path, req.connection_key, exc) from exc\n\n        return proto\n\n\nclass NamedPipeConnector(BaseConnector):\n    \"\"\"Named pipe connector.\n\n    Only supported by the proactor event loop.\n    See also: https://docs.python.org/3/library/asyncio-eventloop.html\n\n    path - Windows named pipe path.\n    keepalive_timeout - (optional) Keep-alive timeout.\n    force_close - Set to True to force close and do reconnect\n        after each request (and between redirects).\n    limit - The total number of simultaneous connections.\n    limit_per_host - Number of simultaneous connections to one host.\n    loop - Optional event loop.\n    \"\"\"","sourceCodeStart":1698,"sourceCodeEnd":1734,"githubUrl":"https://github.com/aio-libs/aiohttp/blob/c0ef574e29109210e96e652771ae4e7b88615fa4/aiohttp/connector.py#L1698-L1734","documentation":"Raised by UnixConnector._create_connection() when loop.create_unix_connection() raises an OSError that is not an asyncio.TimeoutError. aiohttp wraps it as UnixClientConnectorError(path, connection_key, exc) so the caller knows both the socket path and the target request that failed. Typical causes: the socket path does not exist, permissions are wrong, or the socket is not listening.","triggerScenarios":"Requesting a URL whose connector is a UnixConnector pointed at a path that does not exist, is not a socket, has no read/write permission, or whose server has stopped listening.","commonSituations":"Talking to a docker/mysqld/postgres control socket that isn't running. Wrong path in config. Permission denied because the process runs as the wrong user. Container restart left the socket file behind/stale.","solutions":["Verify the path: `ls -l /var/run/foo.sock` and `test -S /var/run/foo.sock`.","Ensure the process uid has read/write on the socket.","Confirm the daemon is running and listening on that socket.","Remove stale socket files and restart the server if the path exists but is dead."],"exampleFix":"# before\nconnector = aiohttp.UnixConnector('/var/run/missing.sock')\n# after\nconnector = aiohttp.UnixConnector('/var/run/real.sock')\n# verify: ls -l /var/run/real.sock","handlingStrategy":"validation","validationCode":"import os, stat\n\ndef unix_socket_ok(path: str) -> bool:\n    try:\n        st = os.stat(path)\n    except OSError:\n        return False\n    return stat.S_ISSOCK(st.st_mode) and os.access(path, os.R_OK | os.W_OK)","typeGuard":null,"tryCatchPattern":"from aiohttp import UnixClientConnectorError\ntry:\n    await session.get(url)\nexcept UnixClientConnectorError as e:\n    # e.path is the socket path; e.os_error has errno\n    raise","preventionTips":["Health-check the socket path (existence + permissions) before issuing requests.","Run the client process as a user permitted to access the socket.","Clean up stale socket files in your service lifecycle."],"tags":["connector","unix-socket","filesystem","ipc","client"],"analyzedSha":"c0ef574e29109210e96e652771ae4e7b88615fa4","analyzedAt":"2026-08-04T19:51:05.467Z","schemaVersion":2}