{"record":{"id":"87e0000a87726ef9","repo":"chenhg5/cc-connect","slug":"runtime-config-stdout-pipe-w","errorCode":null,"errorMessage":"runtime config stdout pipe: %w","messagePattern":"runtime config stdout pipe: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/codex/session.go","lineNumber":673,"sourceCode":"\t}\n\treturn s == \"completed\" || s == \"success\" || s == \"succeeded\" || s == \"ok\"\n}\n\nfunc loadCodexRuntimeConfig(ctx context.Context, workDir string, extraEnv []string) (string, string, error) {\n\tcmd := exec.CommandContext(ctx, \"codex\", \"app-server\")\n\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","sourceCodeStart":655,"sourceCodeEnd":691,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/codex/session.go#L655-L691","documentation":"loadCodexRuntimeConfig failed while creating the child process's stdout pipe via cmd.StdoutPipe() before starting the codex app-server probe process. Like the stdin-pipe variant, this indicates the OS refused to allocate a pipe — typically resource exhaustion — and runtime configuration cannot be retrieved.","triggerScenarios":"cmd.StdoutPipe() returns a non-nil error inside loadCodexRuntimeConfig after the stdin pipe was created successfully.","commonSituations":"File-descriptor exhaustion from leaked child processes or concurrent sessions; sandboxed/containerized environments with tight RLIMIT_NOFILE; fork/exec resource limits on shared hosts.","solutions":["Check and raise the file-descriptor limit (`ulimit -n`) for the cc-connect daemon.","Kill leaked codex app-server processes and verify sessions are stopped so pipes get released.","Retry after freeing descriptors; this error is not caused by the codex binary itself.","Reduce concurrent agent sessions if the process is creating many child processes at once."],"exampleFix":"// before: systemd unit with default LimitNOFILE=1024 under heavy session load\n// after: cc-connect.service\n[Service]\nLimitNOFILE=65536","handlingStrategy":"retry","validationCode":"var lim syscall.Rlimit\nsyscall.Getrlimit(syscall.RLIMIT_NOFILE, &lim)\nif lim.Cur < 4096 {\n    return fmt.Errorf(\"insufficient fd headroom: %d\", lim.Cur)\n}","typeGuard":null,"tryCatchPattern":"cfg, _, err := loadCodexRuntimeConfig(ctx, ...)\nif err != nil && strings.Contains(err.Error(), \"stdout pipe\") {\n    time.Sleep(500 * time.Millisecond)\n    cfg, _, err = loadCodexRuntimeConfig(ctx, ...)\n}","preventionTips":["Raise RLIMIT_NOFILE for the daemon process","Kill leaked codex app-server processes that exhaust descriptors","Limit concurrency of runtime-config probes","Alert on rising open-FD counts in the daemon"],"tags":["codex","os-exec","pipe","file-descriptors"],"backgroundTag":"pipe-creation-failed","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}