chenhg5/cc-connect · error

%s

Error message

%s

What it means

An event payload: when the Cursor CLI process exits non-zero with non-empty stderr, the trimmed stderr text is emitted as core.EventError via fmt.Errorf("%s", ...), relaying Cursor's own failure output to the messaging user.

Source

Thrown at agent/cursor/session.go:189

}

func (cs *cursorSession) readLoop(cmd *exec.Cmd, stdout io.ReadCloser, stderrBuf *bytes.Buffer) {
	defer cs.wg.Done()
	defer func() {
		// Close stdin so Cursor knows the input stream is finished.
		cs.stdinMu.Lock()
		if cs.stdin != nil {
			_ = cs.stdin.Close()
			cs.stdin = nil
		}
		cs.stdinMu.Unlock()
	}()
	defer func() {
		if err := cmd.Wait(); err != nil {
			stderrMsg := strings.TrimSpace(stderrBuf.String())
			if stderrMsg != "" {
				slog.Error("cursorSession: process failed", "error", err, "stderr", stderrMsg)
				evt := core.Event{Type: core.EventError, Error: fmt.Errorf("%s", stderrMsg)}
				select {
				case cs.events <- evt:
				case <-cs.ctx.Done():
					return
				}
			}
		}
	}()

	scanner := bufio.NewScanner(stdout)
	scanner.Buffer(make([]byte, 0, 64*1024), 10*1024*1024)

	for scanner.Scan() {
		line := scanner.Text()
		if line == "" {
			continue
		}

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Read the stderr text for Cursor's own failure reason
  2. Fix the cause (auth, flags, workspace problems) and resend
  3. Reproduce by running the cursor CLI manually with the same args
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at agent/cursor/session.go:189 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/381a050565f47fa4. Report an issue: GitHub.