chenhg5/cc-connect · error
%s
Error message
%s
What it means
An event payload, not a thrown error: when the codex subprocess exits non-zero and its captured stderr is non-empty, the trimmed stderr text is emitted as core.EventError via fmt.Errorf("%s", ...), surfacing codex's own failure message to the user.
Source
Thrown at agent/codex/session.go:307
return ".jpg"
case "image/gif":
return ".gif"
case "image/webp":
return ".webp"
default:
return ".png"
}
}
func (cs *codexSession) readLoop(cmd *exec.Cmd, stdout io.ReadCloser, stderrBuf *bytes.Buffer) {
defer cs.wg.Done()
defer func() {
defer cs.removeCmd(cmd)
if err := cmd.Wait(); err != nil {
stderrMsg := strings.TrimSpace(stderrBuf.String())
if stderrMsg != "" {
slog.Error("codexSession: process failed", "error", err, "stderr", stderrMsg)
evt := core.Event{Type: core.EventError, Error: fmt.Errorf("%s", stderrMsg)}
select {
case cs.events <- evt:
case <-cs.ctx.Done():
return
}
}
}
if tid := cs.CurrentSessionID(); tid != "" {
patchSessionSource(tid, getenvFromList(cs.extraEnv, "CODEX_HOME"))
}
}()
if err := readJSONLines(stdout, func(line []byte) error {
lineText := string(line)
if lineText == "" {
return nil
}
View on GitHub (pinned to 4000b2338a)
Solutions
- Read the stderr text — it is codex's own error (auth, rate limit, bad flags)
- Fix the reported cause and resend the prompt
- Run 'codex exec' manually with the same args to reproduce
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at agent/codex/session.go:307 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/1b3cee4bf4c50468.
Report an issue: GitHub.