HKUDS/nanobot · error · ConnectionError

Signal SSE stream closed by remote endpoint

Error message

Signal SSE stream closed by remote endpoint

What it means

Error "Signal SSE stream closed by remote endpoint" thrown in HKUDS/nanobot.

Source

Thrown at nanobot/channels/signal/runtime.py:666

                                    self.logger.warning(
                                        "Invalid JSON in SSE buffer: {}, data: {}",
                                        e,
                                        data_str[:200],
                                    )
                                finally:
                                    event_buffer = []

                        # "data:" line - accumulate it
                        elif line.startswith("data:"):
                            # SSE spec: strip one optional leading space after "data:".
                            event_buffer.append(line[6:] if line[5:6] == " " else line[5:])

                        # "event:" line - just log it (we only care about data)
                        elif line.startswith("event:"):
                            pass  # Ignore event type for now

                if self._running:
                    raise ConnectionError("Signal SSE stream closed by remote endpoint")

        except asyncio.CancelledError:
            self.logger.info("SSE receive loop cancelled")
            raise
        except Exception as e:
            self.logger.error("Error in SSE receive loop: {}", e)
            raise

    @asynccontextmanager  # pyright: ignore[reportDeprecated]
    async def _safe_handle(self, action: str, payload: Any = None) -> AsyncIterator[None]:
        """Swallow and log any exception from a top-level handler block.

        Logs `self.logger.error` with the action name, the exception, and a
        bounded ``repr`` of the offending payload so the offending input is
        recoverable from logs without having to correlate by timestamp.
        """
        try:
            yield

View on GitHub (pinned to 42f37dc4c0)

When it happens

Trigger: Thrown at nanobot/channels/signal/runtime.py:666 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of HKUDS/nanobot@42f37dc4c0 (2026-08-26). Data as JSON: /api/errors/4b009967a14faab3. Report an issue: GitHub.