chenhg5/cc-connect · error

acp: stdin pipe: %w

Error message

acp: stdin pipe: %w

What it means

Raised in newACPSession when exec.Cmd.StdinPipe() fails while wiring pipes to the freshly-built agent process command. It fires before the process is even started — an OS-level pipe allocation failure, which is rare and usually indicates exhausted file descriptors or process limits.

Source

Thrown at agent/acp/session.go:104

		workDir:       absWorkDir,
		events:        make(chan core.Event, 128),
		ctx:           sessionCtx,
		cancel:        cancel,
		permByID:      make(map[string]permState),
		toolInputByID: make(map[string]string),
		acpSessID:     cfg.resumeSessionID,
		callbacks:     cfg.callbacks,
	}
	s.alive.Store(true)

	cmd := exec.CommandContext(sessionCtx, cfg.command, cfg.args...)
	cmd.Dir = absWorkDir
	cmd.Env = core.MergeEnv(os.Environ(), cfg.extraEnv)

	stdin, err := cmd.StdinPipe()
	if err != nil {
		cancel()
		return nil, fmt.Errorf("acp: stdin pipe: %w", err)
	}
	stdout, err := cmd.StdoutPipe()
	if err != nil {
		cancel()
		return nil, fmt.Errorf("acp: stdout pipe: %w", err)
	}
	var stderrBuf bytes.Buffer
	cmd.Stderr = io.MultiWriter(&stderrBuf, os.Stderr)

	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)

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Check the process/file-descriptor limit (ulimit -n) and raise it if low
  2. Reduce the number of concurrently running agent sessions
  3. Reboot or investigate system-wide fd exhaustion if it persists
Defensive patterns

Strategy: try-catch

When it happens

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