chenhg5/cc-connect · error

runtime config start app-server: %w

Error message

runtime config start app-server: %w

What it means

loadCodexRuntimeConfig called cmd.Start() to launch the codex app-server probe process and the OS failed to start it. cmd.Start() fails when the executable cannot be found/executed, permissions are wrong, or fork/exec resources are unavailable, so the runtime configuration query aborts with this wrapped error.

Source

Thrown at agent/codex/session.go:679

	cmd.Dir = workDir
	prepareCmdForKill(cmd)
	if len(extraEnv) > 0 {
		cmd.Env = core.MergeEnv(os.Environ(), extraEnv)
	}

	stdin, err := cmd.StdinPipe()
	if err != nil {
		return "", "", fmt.Errorf("runtime config stdin pipe: %w", err)
	}
	stdout, err := cmd.StdoutPipe()
	if err != nil {
		return "", "", fmt.Errorf("runtime config stdout pipe: %w", err)
	}
	var stderr bytes.Buffer
	cmd.Stderr = &stderr

	if err := cmd.Start(); err != nil {
		return "", "", fmt.Errorf("runtime config start app-server: %w", err)
	}
	defer func() {
		_ = stdin.Close()
		if cmd.Process != nil {
			_ = cmd.Process.Kill()
		}
		_ = cmd.Wait()
	}()

	reader := bufio.NewReader(stdout)
	nextID := int64(1)

	if err := rpcRequestOverIO(stdin, reader, nextID, "initialize", map[string]any{
		"clientInfo": map[string]any{
			"name":    "cc-connect-codex-runtime-config",
			"title":   "CC Connect Codex Runtime Config",
			"version": "0.1.0",
		},

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Verify the codex binary exists and is executable: `which codex && codex --version`, using the same PATH as the daemon.
  2. If the daemon runs under systemd/launchd, set the absolute codex path in config or extend the service's PATH/Environment.
  3. Reinstall or update the Codex CLI (`npm i -g @openai/codex` or your install method) if it was removed.
  4. Check daemon logs for the underlying exec error (ENOENT vs EACCES) to distinguish not-found from permission problems.
  5. Free exec resources (process limits) if the error is EAGAIN rather than ENOENT/EACCES.

Example fix

// before: config.toml with bare name that the daemon's minimal PATH cannot resolve
command = "codex"
// after
command = "/usr/local/bin/codex"
Defensive patterns

Strategy: validation

Validate before calling

// validate the codex binary before any session/probe attempt
path, err := exec.LookPath(cfg.Command)
if err != nil {
    return fmt.Errorf("codex binary %q not found in PATH: %w", cfg.Command, err)
}
if info, err := os.Stat(path); err != nil || info.Mode()&0o111 == 0 {
    return fmt.Errorf("codex binary %q is not executable", path)
}

Try / catch

cfg, _, err := loadCodexRuntimeConfig(ctx, ...)
if err != nil && strings.Contains(err.Error(), "start app-server") {
    if errors.Is(err, exec.ErrNotFound) {
        // guide the user to install codex or fix the configured path
    }
}

Prevention

When it happens

Trigger: cmd.Start() returns a non-nil error when spawning the codex app-server used to fetch runtime config — typically the codex binary is missing from the resolved PATH, lacks the executable bit, or exec resources are exhausted.

Common situations: Codex CLI not installed or removed after an upgrade; `command` path in config points to a nonexistent binary; daemon runs under systemd/launchd with a minimal PATH that omits the codex install location; binary downloaded but not chmod +x.

Related errors


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