chenhg5/cc-connect · critical

copilotSession: start: %w

Error message

copilotSession: start: %w

What it means

After wiring pipes, newCopilotSession calls child.Start() to launch the copilot CLI process. If the executable cannot be launched the context is cancelled and the error is wrapped as "copilotSession: start: %w" — the underlying os/exec error (ExecNotFoundError, permission denied, etc.) is preserved inside.

Source

Thrown at agent/copilot/session.go:123

	stdin, err := child.StdinPipe()
	if err != nil {
		cancel()
		return nil, fmt.Errorf("copilotSession: stdin pipe: %w", err)
	}

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

	var stderrBuf bytes.Buffer
	child.Stderr = &stderrBuf

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

	cs := &copilotSession{
		cmd:                child,
		rpc:                newRPCClient(stdin),
		reader:             newLSPReader(stdout),
		events:             make(chan core.Event, 64),
		mode:               mode,
		model:              model,
		provider:           provider,
		workDir:            workDir,
		ctx:                sessionCtx,
		cancel:             cancel,
		done:               make(chan struct{}),
		pendingPermissions: make(map[string]json.RawMessage),
		eventPermissions:   make(map[string]struct{}),
	}
	cs.alive.Store(true)

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Verify the binary exists and runs: run the exact path/args from your config manually
  2. Check the `path`/binary setting in config.toml — fix or reinstall the copilot CLI
  3. Ensure execute permission on the binary and that the daemon's PATH includes its directory (GUI services often have a minimal PATH)
  4. Run `cc-connect doctor` (or your platform's diagnostics) to see the resolved CLI path

Example fix

// before (config.toml)
[agents.copilot]
path = "/usr/local/bin/copilotcli"   # stale name
// after
[agents.copilot]
path = "/usr/local/bin/copilot"       # actual installed binary, verified with `which copilot`
Defensive patterns

Strategy: try-catch

Validate before calling

// before starting a session, verify the binary
p := cfg.CopilotPath // e.g. from config
if _, err := os.Stat(p); err != nil {
    return fmt.Errorf("copilot binary not found at %s", p)
}
if info, err := os.Stat(p); err == nil && info.Mode()&0o111 == 0 {
    return fmt.Errorf("copilot binary %s is not executable", p)
}

Try / catch

sess, err := StartSession(ctx, cfg, resumeID)
if err != nil {
    if strings.Contains(err.Error(), "start:") {
        var execErr *exec.Error
        if errors.As(err, &execErr) {
            slog.Error("copilot CLI not launchable", "name", execErr.Name, "err", execErr.Err)
        }
    }
    return err
}

Prevention

When it happens

Trigger: StartSession → newCopilotSession where exec fails: the copilot CLI binary is not on PATH, the path in config is wrong, the binary lacks execute permission, or the working directory/env is invalid.

Common situations: Copilot CLI not installed (missing `copilot` on PATH); config points to an outdated or renamed binary; a version upgrade changed the binary name or location; running under a service account without execute rights on the binary.

Related errors


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