{"record":{"id":"57404b6944f009a3","repo":"HKUDS/Vibe-Trading","slug":"slack-socket-mode-websocket-connect-timed-out","errorCode":null,"errorMessage":"Slack Socket Mode WebSocket connect timed out","messagePattern":"Slack Socket Mode WebSocket connect timed out","errorType":"error_code","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"agent/src/channels/slack.py","lineNumber":134,"sourceCode":"        except Exception as e:\n            self.logger.warning(\"auth_test failed: {}\", e)\n\n        self.logger.info(\"Starting Socket Mode client...\")\n        try:\n            await asyncio.wait_for(\n                self._socket_client.connect(),\n                timeout=SLACK_SOCKET_CONNECT_TIMEOUT_S,\n            )\n        except asyncio.TimeoutError:\n            self.logger.error(\n                \"Slack Socket Mode WebSocket handshake timed out after {:.0f}s. \"\n                \"auth_test uses HTTPS and may still succeed while WSS is blocked. \"\n                \"Check outbound access to Slack WebSockets; slack-sdk Socket Mode \"\n                \"does not apply HTTP(S)_PROXY to websockets.connect.\",\n                SLACK_SOCKET_CONNECT_TIMEOUT_S,\n            )\n            await self.stop()\n            raise RuntimeError(\"Slack Socket Mode WebSocket connect timed out\") from None\n\n        self.logger.info(\"Slack Socket Mode WebSocket connected (events enabled)\")\n\n        while self._running:\n            await asyncio.sleep(1)\n\n    async def stop(self) -> None:\n        \"\"\"Stop the Slack client.\"\"\"\n        self._running = False\n        if self._socket_client:\n            try:\n                await self._socket_client.close()\n            except Exception as e:\n                self.logger.warning(\"socket close failed: {}\", e)\n            self._socket_client = None\n\n    async def send(self, msg: OutboundMessage) -> None:\n        \"\"\"Send a message through Slack.\"\"\"","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/channels/slack.py#L116-L152","documentation":"Slack Socket Mode client's WebSocket connection did not complete within SLACK_SOCKET_CONNECT_TIMEOUT_S; auth_test over HTTPS can succeed while WSS is blocked.","triggerScenarios":"start() when outbound WebSocket traffic to wss://wss-primary.slack.com is blocked by a firewall/proxy; the HTTP-level connection test passed but the socket-mode handshake timed out.","commonSituations":"Corporate proxies that allow HTTPS but not WSS; slack-sdk's websockets.connect ignores HTTP(S)_PROXY env vars.","solutions":["Open outbound access to Slack WebSocket endpoints (wss-primary.slack.com:443)","If a proxy is mandatory, route WSS through it explicitly (e.g. python-socks/websockets proxy support) since slack-sdk won't use HTTP(S)_PROXY","Verify with a manual wss connection test from the same host"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"import socket\nsocket.create_connection(('wss-primary.slack.com', 443), timeout=5).close()","typeGuard":null,"tryCatchPattern":"try:\n    await slack.start()\nexcept RuntimeError as e:\n    if 'WebSocket connect timed out' in str(e):\n        switch_to_alternate_transport_or_alert_ops()","preventionTips":["Verify WSS egress in deployment network policy","Remember slack-sdk ignores HTTP(S)_PROXY for websockets"],"tags":["slack","websocket","network","timeout","proxy"],"backgroundTag":"websocket-connect-timeout","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}