chenhg5/cc-connect · error

opencodeSession: start: %w

Error message

opencodeSession: start: %w

What it means

Wraps a failed cmd.Start() in opencodeSession.Send: the opencode binary could not be spawned for this turn. Fires on a missing/non-executable binary at spawn time, invalid workDir, or OS exec refusal; the turn aborts before the read loop starts.

Source

Thrown at agent/opencode/session.go:109

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

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

	var stderrBuf bytes.Buffer
	cmd.Stderr = &stderrBuf
	cmd.Stdin = strings.NewReader(prompt)

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

	s.wg.Add(1)
	go s.readLoop(cmd, stdout, &stderrBuf)

	return nil
}

func (s *opencodeSession) stageImages(prompt string, images []core.ImageAttachment) (string, []string, error) {
	if len(images) == 0 {
		return prompt, nil, nil
	}

	imgDir := filepath.Join(s.workDir, ".cc-connect", "images")
	if err := os.MkdirAll(imgDir, 0o755); err != nil {
		return "", nil, fmt.Errorf("opencodeSession: create image dir: %w", err)
	}

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Verify the opencode binary is installed and runnable
  2. Check the session workDir exists
  3. Read the wrapped error for the exec cause
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at agent/opencode/session.go:109 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/4ba725ff861549dc. Report an issue: GitHub.