chenhg5/cc-connect · error

pi: '%s' not found in PATH, install with: npm install -g @ma

Error message

pi: '%s' not found in PATH, install with: npm install -g @mariozechner/pi-coding-agent

What it means

An event payload in the opencode readLoop teardown: when the process wrote non-empty stderr, the text (after special handling of stale 'Session not found' IDs, which are cleared) is emitted as core.EventError via fmt.Errorf("%s", ...), relaying opencode's own error output to the user.

Source

Thrown at agent/pi/pi.go:51

	sessionEnv   []string
	mu           sync.Mutex
}

func New(opts map[string]any) (core.Agent, error) {
	workDir, _ := opts["work_dir"].(string)
	if workDir == "" {
		workDir = "."
	}
	model, _ := opts["model"].(string)
	mode, _ := opts["mode"].(string)
	mode = normalizeMode(mode)
	thinking, _ := opts["thinking"].(string)
	rpc, _ := opts["rpc"].(bool)

	cmd, extraArgs := core.ParseCmdOpts(opts, "pi")

	if _, err := exec.LookPath(cmd); err != nil {
		return nil, fmt.Errorf("pi: '%s' not found in PATH, install with: npm install -g @mariozechner/pi-coding-agent", cmd)
	}

	// If model not specified in opts, try defaultModel from settings.json
	if model == "" {
		if def, err := readDefaultModel(); err == nil && def != "" {
			model = def
		}
	}

	return &Agent{
		cmd:          cmd,
		cliExtraArgs: extraArgs,
		configEnv:    core.ParseConfigEnv(opts),
		workDir:      workDir,
		model:        model,
		mode:         mode,
		thinking:     thinking,
		rpc:          rpc,

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Read the stderr text — it is opencode's own complaint
  2. Fix the cause and resend; stale session IDs are auto-cleared
  3. Run opencode manually to reproduce persistent errors
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at agent/pi/pi.go:51 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/8a1b5d279467ba5c. Report an issue: GitHub.