chenhg5/cc-connect · error

%s

Error message

%s

What it means

summarizeIFlowError extracts a human-readable failure reason from iflow CLI output: it skips JSON-looking lines, truncates to 300 runes, and wraps the first plain-text error line in an error via fmt.Errorf("%s", line). The message is therefore raw CLI output, not a fixed string.

Source

Thrown at agent/iflow/session.go:866

}

func summarizeIFlowError(stderrText string, waitErr error) error {
	if stderrText != "" {
		for _, line := range strings.Split(stderrText, "\n") {
			line = strings.TrimSpace(line)
			if line == "" {
				continue
			}
			if strings.HasPrefix(line, "<Execution Info>") || strings.HasPrefix(line, "</Execution Info>") {
				continue
			}
			if strings.HasPrefix(line, "{") || strings.HasPrefix(line, "}") || strings.HasPrefix(line, "\"") {
				continue
			}
			if utf8.RuneCountInString(line) > 300 {
				line = string([]rune(line)[:300]) + "..."
			}
			return fmt.Errorf("%s", line)
		}
	}
	if waitErr != nil {
		return fmt.Errorf("iflow process failed: %w", waitErr)
	}
	return fmt.Errorf("iflow API request failed")
}

func (s *iflowSession) RespondPermission(_ string, _ core.PermissionResult) error {
	return nil
}

func (s *iflowSession) Events() <-chan core.Event {
	return s.events
}

func (s *iflowSession) CurrentSessionID() string {
	v, _ := s.sessionID.Load().(string)

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Read the wrapped line in the error message — it is the actual CLI diagnosis — and fix that condition
  2. Re-authenticate or refresh iflow credentials if the line mentions auth/token
  3. Check quota/billing if the line mentions rate or quota
  4. Validate the requested model name against `iflow --help` / supported models
Defensive patterns

Strategy: try-catch

Try / catch

if err := session.Send(ctx, msg, nil); err != nil {
    msgText := err.Error() // the raw CLI line
    if strings.Contains(msgText, "auth") || strings.Contains(msgText, "token") {
        reauthenticateIFlow()
    } else if strings.Contains(msgText, "quota") {
        backoffAndRetry(msg)
    }
}

Prevention

When it happens

Trigger: readLoop calls summarizeIFlowError after the iflow process fails, and the CLI's stderr/stdout contained a plain-text (non-JSON) error line, e.g. quota exhausted, invalid API key, or model not available.

Common situations: Expired/invalid iflow credentials; upstream API quota or rate limit; requesting a model name the CLI doesn't support; network failure reported as a text line by the CLI.

Related errors


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