chenhg5/cc-connect · error

codexSession: start: %w

Error message

codexSession: start: %w

What it means

Wraps a failed cmd.Start() in codexSession.Send: the codex binary could not be spawned for this turn. It fires when the binary is missing/not executable at spawn time (e.g. uninstalled after agent creation), the workDir is invalid, or the OS refuses the exec.

Source

Thrown at agent/codex/session.go:168

	cmd := exec.CommandContext(cs.ctx, bin, args...)
	cmd.Dir = cs.workDir
	prepareCmdForKill(cmd)
	if len(cs.extraEnv) > 0 {
		cmd.Env = core.MergeEnv(os.Environ(), cs.extraEnv)
	}
	cmd.Stdin = strings.NewReader(prompt)

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

	var stderrBuf bytes.Buffer
	cmd.Stderr = &stderrBuf

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

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

	return nil
}

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

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

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Verify the codex binary is installed and executable
  2. Check that the session workDir exists
  3. Look at the wrapped error for exec-specific causes (permission, ENOENT)
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at agent/codex/session.go:168 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/30605c12c8ecbc18. Report an issue: GitHub.