chenhg5/cc-connect · error

%s

Error message

%s

What it means

Not a thrown error but an event payload: when the ACP agent process exits with an error and its captured stderr is non-empty, the trimmed stderr text is emitted as a core.EventError using a trivial fmt.Errorf("%s", msg). It surfaces the agent's own crash output to the messaging platform user.

Source

Thrown at agent/acp/session.go:131

	s.cmd = cmd
	s.tr = newTransport(stdout, stdin, s.onNotification, s.onServerRequest)

	if err := cmd.Start(); err != nil {
		cancel()
		return nil, fmt.Errorf("acp: start %s: %w", cfg.command, err)
	}

	s.wg.Add(1)
	go func() {
		defer s.wg.Done()
		s.tr.readLoop(sessionCtx)
		waitErr := cmd.Wait()
		if waitErr != nil {
			msg := stderrBuf.String()
			if msg != "" {
				slog.Error("acp: process exited", "error", waitErr, "stderr", msg)
				s.emit(core.Event{Type: core.EventError, Error: fmt.Errorf("%s", strings.TrimSpace(msg))})
			} else {
				slog.Debug("acp: process exited", "error", waitErr)
			}
		}
		s.alive.Store(false)
	}()

	if err := s.handshake(cfg.resumeSessionID, cfg.authMethod); err != nil {
		_ = s.Close()
		return nil, err
	}

	// Apply the agent-level mode preference now that we have a session
	// id. If set_mode fails (e.g. modeId unknown to this backend) we
	// log and carry on with whatever mode the server defaulted to —
	// the alternative would be to reject the session entirely, which
	// is worse UX for a non-critical control.
	if strings.TrimSpace(cfg.initialMode) != "" {

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Read the stderr text — it comes from the agent process itself and states why it died
  2. Address the agent-side issue (auth, flags, config, crash) and retry the turn
  3. If stderr is unhelpful, run the agent CLI manually with the same arguments
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at agent/acp/session.go:131 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/1d481ff847153ea0. Report an issue: GitHub.