chenhg5/cc-connect · error

cursorSession: stdout pipe: %w

Error message

cursorSession: stdout pipe: %w

What it means

Wraps a failed exec.Cmd.StdoutPipe() in cursorSession.Send while preparing the Cursor CLI subprocess for a turn. Pre-spawn pipe allocation failure — nearly always OS fd exhaustion rather than anything Cursor-related.

Source

Thrown at agent/cursor/session.go:145

	}
	if cs.model != "" {
		args = append(args, "--model", cs.model)
	}
	args = append(args, "--workspace", cs.workDir, "--", prompt)

	slog.Debug("cursorSession: launching", "resume", isResume, "args", core.RedactArgs(args))

	cmd := exec.CommandContext(cs.ctx, cs.cmd, args...)
	cmd.Dir = cs.workDir
	env := os.Environ()
	if len(cs.extraEnv) > 0 {
		env = core.MergeEnv(env, cs.extraEnv)
	}
	cmd.Env = env

	stdout, err := cmd.StdoutPipe()
	if err != nil {
		return fmt.Errorf("cursorSession: stdout pipe: %w", err)
	}

	// Set up a stdin pipe so we can write interaction_query responses back to Cursor.
	// Without a connected stdin, Cursor gets EOF and auto-rejects all permission requests.
	stdin, err := cmd.StdinPipe()
	if err != nil {
		return fmt.Errorf("cursorSession: stdin pipe: %w", err)
	}

	var stderrBuf bytes.Buffer
	cmd.Stderr = &stderrBuf

	if err := cmd.Start(); err != nil {
		_ = stdin.Close()
		return fmt.Errorf("cursorSession: start: %w", err)
	}

	cs.stdinMu.Lock()

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Raise the file-descriptor limit (ulimit -n)
  2. Lower concurrency of cursor sessions
  3. Investigate fd leaks in the long-running daemon
Defensive patterns

Strategy: try-catch

When it happens

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