{"record":{"id":"d5a86affc3b7a0d6","repo":"chenhg5/cc-connect","slug":"iflow-api-request-failed","errorCode":null,"errorMessage":"iflow API request failed","messagePattern":"iflow API request failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/iflow/session.go","lineNumber":872,"sourceCode":"\t\t\tif line == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif strings.HasPrefix(line, \"<Execution Info>\") || strings.HasPrefix(line, \"</Execution Info>\") {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif strings.HasPrefix(line, \"{\") || strings.HasPrefix(line, \"}\") || strings.HasPrefix(line, \"\\\"\") {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif utf8.RuneCountInString(line) > 300 {\n\t\t\t\tline = string([]rune(line)[:300]) + \"...\"\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"%s\", line)\n\t\t}\n\t}\n\tif waitErr != nil {\n\t\treturn fmt.Errorf(\"iflow process failed: %w\", waitErr)\n\t}\n\treturn fmt.Errorf(\"iflow API request failed\")\n}\n\nfunc (s *iflowSession) RespondPermission(_ string, _ core.PermissionResult) error {\n\treturn nil\n}\n\nfunc (s *iflowSession) Events() <-chan core.Event {\n\treturn s.events\n}\n\nfunc (s *iflowSession) CurrentSessionID() string {\n\tv, _ := s.sessionID.Load().(string)\n\treturn v\n}\n\nfunc (s *iflowSession) Alive() bool {\n\treturn s.alive.Load()\n}","sourceCodeStart":854,"sourceCodeEnd":890,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/iflow/session.go#L854-L890","documentation":"summarizeIFlowError's fallback: returned when no parseable error line was found in the CLI output and the process wait produced no error either — the iflow process failed its API request without explaining why. It is a last-resort generic error.","triggerScenarios":"readLoop calls summarizeIFlowError and the iflow CLI produced no parsable text and exited without a wait error, e.g. it printed only JSON error objects that the summarizer skips.","commonSituations":"Upstream iflow API outage returning JSON error bodies; CLI output format changed so the summarizer's heuristics no longer match; empty output with non-zero logical failure.","solutions":["Enable debug/verbose logging of the iflow CLI output to capture the raw JSON error","Check iflow service status / network connectivity","Upgrade or patch the summarizer to also inspect JSON error lines if the CLI changed format","Retry the turn; transient upstream API failures often resolve"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := session.Send(ctx, msg, nil); err != nil {\n    if err.Error() == \"iflow API request failed\" {\n        if attempt < maxAttempts { time.Sleep(backoff); retry() }\n        else { notifyUserUpstreamOutage() }\n    }\n}","preventionTips":["Implement bounded retries with backoff for this opaque failure","Log raw CLI output at debug level to compensate for the generic message","Alert on iflow service status to distinguish outage from local misconfig"],"tags":["go","cli","api","iflow"],"backgroundTag":"upstream-api-error","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"}