koala73/worldmonitor · error

SSE connect HTTP ${resp.status}

Error message

SSE connect HTTP ${resp.status}

What it means

Thrown by SseSession.connect when the initial SSE GET to the MCP server's streamable-HTTP endpoint returned a non-2xx status. The SSRF revalidation passed but the server refused the event-stream connection (auth, wrong URL, or transient upstream failure), so no SSE transport could be established.

Source

Thrown at api/mcp-proxy.ts:383

  constructor(sseUrl, headers) {
    this._sseUrl = sseUrl;
    this._originHost = new URL(sseUrl).host;
    this._originProtocol = new URL(sseUrl).protocol;
    this._headers = headers;
    this._endpointUrl = null;
    this._endpointDeferred = makeDeferred();
    this._pending = new Map(); // rpc id -> deferred
    this._reader = null;
  }

  async connect() {
    await revalidateBeforeFetch(new URL(this._sseUrl));
    const resp = await fetch(this._sseUrl, {
      headers: { ...this._headers, Accept: 'text/event-stream', 'Cache-Control': 'no-cache' },
      redirect: 'manual',
      signal: AbortSignal.timeout(SSE_CONNECT_TIMEOUT_MS),
    });
    if (!resp.ok) throw new Error(`SSE connect HTTP ${resp.status}`);
    this._reader = resp.body.getReader();
    this._startReadLoop();
    await this._endpointDeferred.promise;
  }

  _startReadLoop() {
    const dec = new TextDecoder();
    let buf = '';
    let eventType = '';
    const reader = this._reader;

    (async () => {
      try {
        while (true) {
          const { done, value } = await reader.read();
          if (done) {
            // Stream closed — if endpoint never arrived, reject so connect() throws
            if (!this._endpointUrl) {

View on GitHub (pinned to 9361220cc0)

Solutions

  1. Check the status code: 401/403 indicates missing auth headers on the SSE connection, 404 a wrong SSE endpoint URL
  2. Confirm the server supports the legacy SSE transport, not only streamable HTTP POST
  3. Retry transient 5xx statuses; SSE endpoints behind load balancers can fail intermittently
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at api/mcp-proxy.ts:381 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of koala73/worldmonitor@9361220cc0 (2026-08-21). Data as JSON: /api/errors/3ee7632f7f62e3f1. Report an issue: GitHub.