{"record":{"id":"b41ff9892a7fc5ad","repo":"chenhg5/cc-connect","slug":"runtime-config-start-app-server-w","errorCode":null,"errorMessage":"runtime config start app-server: %w","messagePattern":"runtime config start app-server: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/codex/session.go","lineNumber":679,"sourceCode":"\tcmd.Dir = workDir\n\tprepareCmdForKill(cmd)\n\tif len(extraEnv) > 0 {\n\t\tcmd.Env = core.MergeEnv(os.Environ(), extraEnv)\n\t}\n\n\tstdin, err := cmd.StdinPipe()\n\tif err != nil {\n\t\treturn \"\", \"\", fmt.Errorf(\"runtime config stdin pipe: %w\", err)\n\t}\n\tstdout, err := cmd.StdoutPipe()\n\tif err != nil {\n\t\treturn \"\", \"\", fmt.Errorf(\"runtime config stdout pipe: %w\", err)\n\t}\n\tvar stderr bytes.Buffer\n\tcmd.Stderr = &stderr\n\n\tif err := cmd.Start(); err != nil {\n\t\treturn \"\", \"\", fmt.Errorf(\"runtime config start app-server: %w\", err)\n\t}\n\tdefer func() {\n\t\t_ = stdin.Close()\n\t\tif cmd.Process != nil {\n\t\t\t_ = cmd.Process.Kill()\n\t\t}\n\t\t_ = cmd.Wait()\n\t}()\n\n\treader := bufio.NewReader(stdout)\n\tnextID := int64(1)\n\n\tif err := rpcRequestOverIO(stdin, reader, nextID, \"initialize\", map[string]any{\n\t\t\"clientInfo\": map[string]any{\n\t\t\t\"name\":    \"cc-connect-codex-runtime-config\",\n\t\t\t\"title\":   \"CC Connect Codex Runtime Config\",\n\t\t\t\"version\": \"0.1.0\",\n\t\t},","sourceCodeStart":661,"sourceCodeEnd":697,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/codex/session.go#L661-L697","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the codex binary exists and is executable: `which codex && codex --version`, using the same PATH as the daemon.","If the daemon runs under systemd/launchd, set the absolute codex path in config or extend the service's PATH/Environment.","Reinstall or update the Codex CLI (`npm i -g @openai/codex` or your install method) if it was removed.","Check daemon logs for the underlying exec error (ENOENT vs EACCES) to distinguish not-found from permission problems.","Free exec resources (process limits) if the error is EAGAIN rather than ENOENT/EACCES."],"exampleFix":"// before: config.toml with bare name that the daemon's minimal PATH cannot resolve\ncommand = \"codex\"\n// after\ncommand = \"/usr/local/bin/codex\"","handlingStrategy":"validation","validationCode":"// validate the codex binary before any session/probe attempt\npath, err := exec.LookPath(cfg.Command)\nif err != nil {\n    return fmt.Errorf(\"codex binary %q not found in PATH: %w\", cfg.Command, err)\n}\nif info, err := os.Stat(path); err != nil || info.Mode()&0o111 == 0 {\n    return fmt.Errorf(\"codex binary %q is not executable\", path)\n}","typeGuard":null,"tryCatchPattern":"cfg, _, err := loadCodexRuntimeConfig(ctx, ...)\nif err != nil && strings.Contains(err.Error(), \"start app-server\") {\n    if errors.Is(err, exec.ErrNotFound) {\n        // guide the user to install codex or fix the configured path\n    }\n}","preventionTips":["Pin the absolute path of the codex binary in config instead of a bare name","Run `cc-connect doctor` (or `codex --version` under the daemon's PATH) at startup","Reinstall codex after upgrades and re-check the executable bit","Extend PATH in systemd/launchd unit files for GUI-launched daemons"],"tags":["codex","process-start","os-exec","command-not-found"],"backgroundTag":"command-not-found","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}