chenhg5/cc-connect · error

SSE connect: %w (reconnecting)

Error message

SSE connect: %w (reconnecting)

What it means

An EventError emitted by the reasonix SSE readLoop when the HTTP connection to GET /events fails while the context is still live: the message wraps the connect error and notes that a reconnect with backoff is underway. Transient by design; the loop retries automatically.

Source

Thrown at agent/reasonix/session.go:250

			s.alive.Store(false)
			return
		default:
		}

		req, err := http.NewRequestWithContext(ctx, "GET", s.serveURL+"/events", nil)
		if err != nil {
			slog.Error("reasonix: create SSE request failed", "error", err)
			return
		}

		resp, err := s.sseClient.Do(req)
		if err != nil {
			if ctx.Err() != nil {
				s.alive.Store(false)
				return
			}
			slog.Warn("reasonix: SSE connect failed, retrying", "error", err, "backoff", backoff)
			s.emit(core.Event{Type: core.EventError, Error: fmt.Errorf("SSE connect: %w (reconnecting)", err)})
			goto retryWait
		}

		if resp.StatusCode != http.StatusOK {
			_ = resp.Body.Close()
			slog.Warn("reasonix: SSE unexpected status, retrying", "status", resp.StatusCode, "backoff", backoff)
			goto retryWait
		}

		slog.Info("reasonix: SSE connected")
		s.alive.Store(true)
		backoff = 1 * time.Second // reset backoff on successful connection
		s.reconnectCount = 0      // reset reconnect count on successful connection
		s.readSSE(ctx, resp.Body)
		_ = resp.Body.Close()

		// Connection dropped; if context is still alive, reconnect
		if ctx.Err() != nil {

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Usually self-heals via automatic reconnection — observe only
  2. If persistent, verify the reasonix serve instance is reachable
  3. Check for proxies/firewalls blocking long-lived SSE connections
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at agent/reasonix/session.go:250 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/0528216aca9cc7a4. Report an issue: GitHub.