chenhg5/cc-connect · error

copilot probe: start: %w

Error message

copilot probe: start: %w

What it means

This error wraps cmd.Start() failing when launching the copilot CLI binary for a probe session used by ListSessions/DeleteSession. Start fails when the binary cannot be found/executed, lacks execute permission, or the working directory/cwd is invalid. Stderr is discarded (io.Discard) so the underlying reason is hidden, making this error notoriously opaque.

Source

Thrown at agent/copilot/copilot.go:229

	cmd := exec.CommandContext(probeCtx, snapshot.cmd, "--headless", "--stdio", "--no-auto-update")
	cmd.Dir = snapshot.workDir
	cmd.Env = snapshot.env

	stdin, err := cmd.StdinPipe()
	if err != nil {
		cancel()
		return nil, fmt.Errorf("copilot probe: stdin pipe: %w", err)
	}
	stdout, err := cmd.StdoutPipe()
	if err != nil {
		cancel()
		return nil, fmt.Errorf("copilot probe: stdout pipe: %w", err)
	}
	cmd.Stderr = io.Discard

	if err := cmd.Start(); err != nil {
		cancel()
		return nil, fmt.Errorf("copilot probe: start: %w", err)
	}

	rpc := newRPCClient(stdin)
	reader := newLSPReader(stdout)
	done := make(chan struct{})

	go func() {
		defer func() {
			_ = stdin.Close()
			_ = cmd.Wait()
			close(done)
		}()
		for {
			body, err := reader.readMessage()
			if err != nil {
				return
			}
			var resp jsonRPCResponse

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Verify the copilot CLI is installed and executable: run `which copilot` / the configured path manually
  2. Check/fix the copilot binary path configured in config.toml (agent options)
  3. Ensure the binary has the execute bit: `chmod +x $(which copilot)`
  4. Reinstall or upgrade the GitHub Copilot CLI to restore the expected binary
  5. Temporarily remove `cmd.Stderr = io.Discard` in newProbeSession while debugging to see the OS error detail

Example fix

// before (debugging)
cmd.Stderr = io.Discard
if err := cmd.Start(); err != nil {
    cancel()
    return nil, fmt.Errorf("copilot probe: start: %w", err)
}
// after (debug)
var stderr bytes.Buffer
cmd.Stderr = &stderr
if err := cmd.Start(); err != nil {
    cancel()
    return nil, fmt.Errorf("copilot probe: start: %w: %s", err, stderr.String())
}
Defensive patterns

Strategy: validation

Validate before calling

// verify the CLI is runnable before probe-dependent calls
bin := "copilot" // or configured path
if path, err := exec.LookPath(bin); err != nil {
    return fmt.Errorf("copilot CLI not found: %w", err)
} else if info, err := os.Stat(path); err != nil || info.Mode()&0o111 == 0 {
    return fmt.Errorf("copilot CLI %s is not executable", path)
}

Try / catch

if _, err := a.ListSessions(ctx); err != nil && strings.Contains(err.Error(), "probe: start:") {
    return fmt.Errorf("copilot CLI missing or not executable — run `cc-connect doctor`: %w", err)
}

Prevention

When it happens

Trigger: ListSessions or DeleteSession invoking newProbeSession when the copilot binary path is wrong, the binary is not installed, is not executable, or exec cannot fork (resource limits).

Common situations: Copilot CLI not installed or not on PATH after a machine rebuild; binary updated/renamed by a copilot version change; config points at a wrong cli_path; running in a slim container without the CLI.

Related errors


AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/1ec3cdd04edff3c2. Report an issue: GitHub.