HKUDS/DeepTutor · error · RuntimeError

Slack Socket Mode WebSocket connect timed out

Error message

Slack Socket Mode WebSocket connect timed out

What it means

The Slack Socket Mode client's WebSocket handshake exceeded SLACK_SOCKET_CONNECT_TIMEOUT_S inside asyncio.wait_for. The earlier HTTPS auth_test may have succeeded while outbound WSS traffic (port 443 websocket to Slack) is blocked by the network, producing asyncio.TimeoutError at start().

Solutions

  1. Open outbound WebSocket access to Slack (wss://wss-primary.slack.com) on the network/proxy
  2. Set HTTPS_PROXY/WSS proxy env vars if a proxy is required
  3. Retry once network conditions change — transient Slack-side outages also cause this
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at deeptutor/partners/channels/slack.py:112 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27). Data as JSON: /api/errors/259a51c620a19026. Report an issue: GitHub.

Appendix: source

Thrown at deeptutor/partners/channels/slack.py:112

        except Exception as e:
            logger.warning("Slack auth_test failed: {}", e)

        logger.info("Starting Slack Socket Mode client...")
        try:
            await asyncio.wait_for(
                self._socket_client.connect(),
                timeout=SLACK_SOCKET_CONNECT_TIMEOUT_S,
            )
        except asyncio.TimeoutError:
            logger.error(
                "Slack Socket Mode WebSocket handshake timed out after {:.0f}s. "
                "auth_test uses HTTPS and may still succeed while WSS is blocked. "
                "Check outbound access to Slack WebSockets; slack-sdk Socket Mode "
                "does not apply HTTP(S)_PROXY to websockets.connect.",
                SLACK_SOCKET_CONNECT_TIMEOUT_S,
            )
            await self.stop()
            raise RuntimeError("Slack Socket Mode WebSocket connect timed out") from None

        logger.info("Slack Socket Mode WebSocket connected (events enabled)")

        while self._running:
            await asyncio.sleep(1)

    async def stop(self) -> None:
        """Stop the Slack client."""
        self._running = False
        if self._socket_client:
            try:
                await self._socket_client.close()
            except Exception as e:
                logger.warning("Slack socket close failed: {}", e)
            self._socket_client = None

    async def send(self, msg: OutboundMessage) -> None:
        """Send a message through Slack.

View on GitHub (pinned to 3e82f13042)