chenhg5/cc-connect · error
codex app-server start: %w
Error message
codex app-server start: %w
What it means
This error wraps a failure from cmd.Start() when launching the codex app-server binary. Start failed before any protocol exchange happened — either the binary could not be executed or process creation failed. The wrapped OS error (exec.Error, exec.ErrNotFound, permission errors) is the real cause.
Source
Thrown at agent/codex/appserver_session.go:277
}
if len(env) > 0 {
cmd.Env = core.MergeEnv(os.Environ(), env)
}
stdin, err := cmd.StdinPipe()
if err != nil {
return fmt.Errorf("codex app-server stdin pipe: %w", err)
}
stdout, err := cmd.StdoutPipe()
if err != nil {
return fmt.Errorf("codex app-server stdout pipe: %w", err)
}
stderr, err := cmd.StderrPipe()
if err != nil {
return fmt.Errorf("codex app-server stderr pipe: %w", err)
}
if err := cmd.Start(); err != nil {
return fmt.Errorf("codex app-server start: %w", err)
}
s.procMu.Lock()
s.cmd = cmd
s.stdin = stdin
s.procMu.Unlock()
slog.Info("codex app-server session started", "transport", "stdio", "pid", cmd.Process.Pid, "work_dir", s.workDir)
s.wg.Add(3)
go s.readLoop(stdout)
go s.stderrLoop(stderr)
go s.waitLoop()
return nil
}
func (s *appServerSession) initialize() error {
params := map[string]any{View on GitHub (pinned to 4000b2338a)
Solutions
- Verify the binary: run `which codex` (or the configured path) manually and confirm it executes.
- Check the agent's configured binary path/command in config.toml for typos or stale absolute paths.
- Ensure the binary is executable (chmod +x) and the target architecture/OS matches.
- Check for fork/resource limits (ulimit -u, container pids-limit) if the binary exists and runs manually.
- Confirm the working directory and environment passed to the command are valid.
Example fix
// before
opts := core.AgentOptions{Command: "/usr/local/bin/codex-app-server"}
// after
// ensure the binary exists before constructing:
if _, err := os.Stat("/usr/local/bin/codex-app-server"); err != nil {
slog.Error("codex binary missing; install codex CLI or fix config path")
}
opts := core.AgentOptions{Command: "codex", Args: []string{"app-server"}} Defensive patterns
Strategy: validation
Validate before calling
bin := cfg.CodexBinary // e.g. "codex"
path, err := exec.LookPath(bin)
if err != nil {
return fmt.Errorf("codex binary %q not found on PATH; install codex CLI", bin)
}
if info, err := os.Stat(path); err != nil || info.Mode()&0o111 == 0 {
return fmt.Errorf("codex binary %s missing or not executable", path)
} Try / catch
if err := session.Start(ctx); err != nil {
var execErr *exec.Error
if errors.As(err, &execErr) {
return fmt.Errorf("cannot execute %q: install codex CLI or fix config path", execErr.Name)
}
return err
} Prevention
- Validate the configured binary path at config load / startup (doctor check).
- Pin the codex CLI in deployment images and verify with `codex --version`.
- Ensure chmod +x survives artifact packaging.
- Check container images include the CLI and match host architecture.
When it happens
Trigger: Calling StartSession on the codex agent with a binary path that does not exist, is not executable, or whose working directory/env setup fails; also failures from fork/exec resource limits (EAGAIN when hitting process/thread limits).
Common situations: Codex CLI not installed or not on PATH after a machine rebuild; config points to the wrong binary path; binary lacks +x after a permission-preserving copy; Docker image missing the CLI; fork limits hit under heavy load.
Related errors
- antigravitySession: start: %w
- copilot probe: start: %w
- copilotSession: start: %w
- kimiSession: start: %w
- opencode: session list: %w
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/7de536ff875c3ba9.
Report an issue: GitHub.