chenhg5/cc-connect · info

session reset

Error message

session reset

What it means

A reason string passed to notifyDroppedQueuedMessages when a session is being reset: queued messages that were never delivered to the agent are dropped and users are notified. Not a failure — expected during /reset or /new flows.

Source

Thrown at core/engine.go:4315

	// Notify senders of any queued messages that will never be processed.
	if ok && state != nil {
		// Stop unsolicited reader before marking stopped to avoid goroutine leak.
		e.stopUnsolicitedReader(state)

		state.markStopped()

		// Resolve any pending permission so the reader goroutine (or event
		// loop) does not block on <-pending.Resolved forever.
		state.mu.Lock()
		pending := state.pending
		state.pending = nil
		state.mu.Unlock()
		if pending != nil {
			pending.resolve()
		}

		e.notifyDroppedQueuedMessages(state, fmt.Errorf("session reset"))
	}

	// Close the agent session BEFORE deleting from the map.
	// This prevents race conditions where /stop during cleanup sees
	// an empty map and reports "No execution in progress" while
	// the agent session Close() is still blocking (up to 130s).
	if agentSession != nil {
		e.closeAgentSessionWithTimeout(sessionKey, agentSession, closePlatform, closeReplyCtx)
	}

	// Now delete the state from the map after the session is closed.
	e.interactiveMu.Lock()
	// Re-check that the state hasn't been replaced during the close
	currentState, currentOk := e.interactiveStates[sessionKey]
	if currentOk && len(expected) > 0 && expected[0] != nil && currentState != expected[0] {
		// Another turn has replaced the state during our close — don't delete it.
		e.interactiveMu.Unlock()
		return

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Inform users that queued prompts are discarded on reset
  2. Wait for queue drain before issuing /new
  3. Re-send the dropped prompt after the new session is ready
Defensive patterns

Strategy: fallback

Try / catch

engine.OnQueuedMessagesDropped(func(key string, reason error) { if strings.Contains(reason.Error(), "session reset") { promptUserToResend(key) } })

Prevention

When it happens

Trigger: Session reset (e.g. /new command) runs while messages still sit in the session's queue.

Common situations: User types /new while the agent is still processing earlier queued prompts; admin resets a stuck session.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


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