chenhg5/cc-connect · error

acp: no active session to cancel

Error message

acp: no active session to cancel

What it means

A sentinel guard in acpSession.CancelTurn (backing /stop): the session has no stored ACP session ID, so there is nothing to send a session/cancel notification to. It fires when /stop is issued before any turn has established an agent-side session.

Source

Thrown at agent/acp/session.go:712

	return s.tr.respondSuccess(st.RPCID, res)
}

func (s *acpSession) Events() <-chan core.Event {
	return s.events
}

func (s *acpSession) CurrentSessionID() string {
	return s.currentACPSessionID()
}

// CancelTurn sends an ACP session/cancel notification to abort the current
// turn while keeping the session alive. The agent should cancel the active
// LLM request and persist state, then wait for the next user message on the
// same connection. This is used by /stop instead of Close().
func (s *acpSession) CancelTurn() error {
	sid := s.currentACPSessionID()
	if sid == "" {
		return fmt.Errorf("acp: no active session to cancel")
	}
	if s.tr == nil {
		return fmt.Errorf("acp: transport not available")
	}
	slog.Debug("acp: cancelling current turn", "session_id", sid)
	return s.tr.sendNotification("session/cancel", map[string]any{
		"sessionId": sid,
	})
}

func (s *acpSession) Alive() bool {
	return s.alive.Load()
}

func (s *acpSession) Close() error {
	s.alive.Store(false)
	s.cancel()
	if s.cmd != nil && s.cmd.Process != nil {

View on GitHub (pinned to 4000b2338a)

Solutions

  1. No action needed if no turn was actually running
  2. Send a message first to establish the ACP session, then use /stop
  3. Ignore the error in UI flows where /stop is a no-op
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at agent/acp/session.go:712 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/138d7dc694b279e4. Report an issue: GitHub.