chenhg5/cc-connect · error

SSE disconnected, reconnecting

Error message

SSE disconnected, reconnecting

What it means

An EventError emitted alongside the SSE reconnect path in reasonix readLoop: the event stream disconnected (non-terminal, context still alive) and the client is reconnecting. Informational — the session stays alive and the next connection resumes event delivery.

Source

Thrown at agent/reasonix/session.go:277

		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 {
			s.alive.Store(false)
			return
		}
		// If a turn is in progress, unblock Send() with a reconnect error
		if s.inTurn.Load() {
			s.mu.Lock()
			s.errTurn = fmt.Errorf("reasonix: SSE disconnected during turn")
			s.mu.Unlock()
			s.emit(core.Event{Type: core.EventResult, Done: true, Error: fmt.Errorf("SSE disconnected, reconnecting")})
			s.inTurn.Store(false)
			s.turnDone <- struct{}{}
		}
		slog.Warn("reasonix: SSE connection lost, reconnecting", "backoff", backoff)

	retryWait:
		s.reconnectCount++
		if s.reconnectCount >= s.maxReconnects {
			slog.Error("reasonix: SSE reconnect limit reached, closing session", "max", s.maxReconnects)
			s.alive.Store(false)
			if s.inTurn.Load() {
				s.inTurn.Store(false)
				s.turnDone <- struct{}{}
			}
			return
		}
		select {
		case <-ctx.Done():

View on GitHub (pinned to 4000b2338a)

Solutions

  1. No action — reconnection is automatic
  2. If frequent, investigate network stability or serve-side idle timeouts
  3. Keep-alive settings on proxies may need adjusting for SSE
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at agent/reasonix/session.go:277 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/1d09771a4e0234ac. Report an issue: GitHub.