chenhg5/cc-connect · error

reasonix: new session: %w

Error message

reasonix: new session: %w

What it means

Wraps a failed POST /new inside reasonix newSession (invoked when no session ID or the literal 'new' is passed): the remote serve instance refused or failed the request to create a fresh session. The session context is cancelled and StartSession surfaces the error.

Source

Thrown at agent/reasonix/session.go:133

		cancel:        cancel,
		events:        make(chan core.Event, 128),
		turnDone:      make(chan struct{}, 1),
		readLoopDone:  make(chan struct{}),
		maxReconnects: 5,
		sseClient: &http.Client{
			Timeout: 0, // no timeout for SSE
			Transport: &http.Transport{
				ResponseHeaderTimeout: 30 * time.Second,
			},
		},
	}
	s.alive.Store(true)

	// Start fresh session on reasonix if sessionID is empty or 'new'
	if sessionID == "" || sessionID == "new" {
		if err := s.httpPost("/new", nil); err != nil {
			cancel()
			return nil, fmt.Errorf("reasonix: new session: %w", err)
		}
		slog.Info("reasonix: created new session")
	}

	// Start SSE reader in background
	readerCtx, readerCancel := context.WithCancel(ctx)
	s.sseCancel = readerCancel
	go s.readLoop(readerCtx)

	return s, nil
}

// ── core.AgentSession implementation ─────────────────────────────

func (s *reasonixSession) Send(prompt string, messageID string, images []core.ImageAttachment, files []core.FileAttachment) error {
	if !s.alive.Load() {
		return fmt.Errorf("reasonix: session is closed")
	}

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Verify the reasonix serve process is up and responsive
  2. Check serve_url correctness and network connectivity
  3. Read the wrapped error for HTTP status/connection details
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at agent/reasonix/session.go:133 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/70a303cc1cd5eff4. Report an issue: GitHub.