HKUDS/Vibe-Trading · error · ConnectionError

SSE connection failed with status {response.status_code}

Error message

SSE connection failed with status {response.status_code}

What it means

The SSE subscription request GET /api/v1/events returned a non-200 status, so the streaming connection could not be established.

Source

Thrown at agent/src/channels/signal.py:601

            raise
        finally:
            # Keep typing active across progress updates; stop on the final reply.
            if not is_progress_message:
                # Avoid immediate START->STOP for fast responses, which can be invisible
                # in some Signal clients. Let indicator expire naturally (~15s).
                await self._stop_typing(msg.chat_id, send_stop=False)

    async def _sse_receive_loop(self) -> None:
        """Receive messages via Server-Sent Events (HTTP mode)."""
        if not self._http:
            raise RuntimeError("HTTP client not initialized for Signal SSE stream")

        self.logger.info("Started Signal message receive loop (SSE)")

        try:
            async with self._http.stream("GET", "/api/v1/events") as response:
                if response.status_code != 200:
                    raise ConnectionError(
                        f"SSE connection failed with status {response.status_code}"
                    )

                self.logger.info("Subscribed to Signal messages via SSE")

                # Buffer for accumulating SSE data across multiple lines
                event_buffer = []

                async for line in response.aiter_lines():
                    if not self._running:
                        break

                    # Debug: log raw SSE lines (except keepalive pings)
                    if line and line != ":":
                        self.logger.debug("SSE line received: {}", line[:200])

                    # SSE format handling
                    if isinstance(line, str):

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Upgrade signal-cli to a version supporting the REST SSE API
  2. Match any configured auth token between signal-cli and channel config
  3. Confirm endpoint path with curl -N http://host:8080/api/v1/events
Defensive patterns

Strategy: retry

Validate before calling

r = await http_client.get(f"{endpoint}/api/v1/events")
if r.status_code != 200:
    raise RuntimeError(f'signal-cli events endpoint: {r.status_code}')

Try / catch

except ConnectionError as e:
    if 'SSE connection failed' in str(e):
        await asyncio.sleep(backoff); retry

Prevention

When it happens

Trigger: start() in HTTP mode when signal-cli rejects the events endpoint: auth required, wrong API version, or daemon version without SSE support.

Common situations: signal-cli too old to support /api/v1/events, or an auth token configured on signal-cli but not in the client.

Related errors


AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28). Data as JSON: /api/errors/885db7a7b6b32576. Report an issue: GitHub.