chenhg5/cc-connect · error

%w (stderr: %s)

Error message

%w (stderr: %s)

What it means

A wrapping step in ListSessions: when the ACP probe handshake (initialize) fails and the agent's captured stderr buffer is non-empty, this re-raises the underlying probe error annotated with up to 200 chars of the agent's stderr output to aid diagnosis. It fires only when both a probe failure and stderr output exist.

Source

Thrown at agent/acp/list_sessions.go:209

	absWorkDir, err := filepath.Abs(workDir)
	if err != nil {
		absWorkDir = workDir
	}

	probeCtx, cancel := context.WithTimeout(ctx, listSessionsProbeTimeout)
	defer cancel()

	started := time.Now()
	tr, stderrBuf, teardown, err := a.probeSpawn(probeCtx, absWorkDir)
	if err != nil {
		return nil, err
	}
	defer teardown()

	init, err := probeInitialize(probeCtx, tr)
	if err != nil {
		if msg := strings.TrimSpace(stderrBuf.String()); msg != "" {
			return nil, fmt.Errorf("%w (stderr: %s)", err, truncateForLog(msg, 200))
		}
		return nil, err
	}
	if len(init.AgentCapabilities.SessionCapabilities.List) == 0 {
		slog.Info("acp: session/list unsupported by agent, caching for fast-path", "command", a.cmd)
		a.listUnsupported.Store(true)
		return nil, nil
	}

	entries, err := probeListSessions(probeCtx, tr, absWorkDir)
	if err != nil {
		return nil, err
	}
	if entries == nil {
		a.listUnsupported.Store(true)
		return nil, nil
	}
	out := convertSessionList(entries, absWorkDir)

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Read the appended stderr text — it is the agent process's own complaint (bad flags, missing auth, crash reason)
  2. Fix the root cause reported in stderr, e.g. install/login/configure the agent CLI
  3. If stderr is truncated, run the agent manually with the same arguments to see full output
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at agent/acp/list_sessions.go:209 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/7e6f927f0ddda1fa. Report an issue: GitHub.