alibaba/open-code-review · error

[ocr] Subtask error for group %q: %v

Error message

[ocr] Subtask error for group %q: %v

What it means

The agent's parallel subtask runner reports a group-level failure: when stop.reportAsError is set and at least one file in the group failed, the checkpoint message becomes an error, is logged to stdout, emitted as a telemetry event, and recorded as a warning. It is a progress/status notification for a subtask group, not a fatal process error — the group can mix Completed and Failed files.

Source

Thrown at internal/agent/agent.go:773

						if comments := a.args.CommentCollector.CommentsForPath(d.NewPath); len(comments) > 0 {
							a.markCompleted(d)
							a.session.RecordReviewItemDone(d.NewPath, d.OldPath, d.NewPath, fingerprint, comments)
							continue
						}
						a.markFailed(d, stop.class, stop.reason)
						if stop.checkpoint != "" {
							a.session.RecordReviewItemFailed(d.NewPath, d.OldPath, d.NewPath, fingerprint, stop.checkpoint)
						}
						failedCount++
					}
					// subtaskFailed must count only the files actually marked failed
					// above, not the whole group — a group can mix Completed and
					// Failed files, and reportAsError itself is a group-level signal
					// (any file with comments suppresses it) that must not be assumed
					// to imply failedCount == len(g.Diffs).
					if stop.reportAsError && failedCount > 0 {
						atomic.AddInt64(&a.subtaskFailed, failedCount)
						stopErr := errors.New(stop.checkpoint)
						fmt.Fprintf(stdout.Writer(), "[ocr] Subtask error for group %q: %v\n", g.Label, stopErr)
						telemetry.ErrorEvent(groupCtx, "subtask.error", stopErr,
							telemetry.AnyToAttr("group.label", g.Label))
						a.recordWarning("subtask_error", g.Label, stopErr.Error())
					}
				}
				return
			}
			for _, d := range g.Diffs {
				fingerprint := reviewItemFingerprint(a.reviewMode(), d)
				comments := a.args.CommentCollector.CommentsForPath(d.NewPath)
				a.markCompleted(d)
				a.session.RecordReviewItemDone(d.NewPath, d.OldPath, d.NewPath, fingerprint, comments)
			}
		}(group)
	}

	wg.Wait()

View on GitHub (pinned to 5cf97d0d15)

Solutions

  1. Inspect the recorded warning key 'subtask_error' and telemetry 'subtask.error' events for the failing group label to find root per-file errors.
  2. Retry the run if the cause was a transient provider error (rate limits, network).
  3. Check group.Diffs for files exceeding size/token limits and exclude or split them.
  4. If subtask failures should not surface as group errors, adjust the stop/reportAsError criteria so Completed files suppress the group-level error.
Defensive patterns

Strategy: try-catch

Try / catch

if stop.reportAsError && failedCount > 0 {
    atomic.AddInt64(&a.subtaskFailed, failedCount)
    stopErr := errors.New(stop.checkpoint)
    fmt.Fprintf(stdout.Writer(), "[ocr] Subtask error for group %q: %v\n", g.Label, stopErr)
    telemetry.ErrorEvent(groupCtx, "subtask.error", stopErr, telemetry.AnyToAttr("group.label", g.Label))
    a.recordWarning("subtask_error", g.Label, stopErr.Error())
}

Prevention

When it happens

Trigger: A subtask group's stop signal sets reportAsError (no file in the group produced comments, so reportAsError stays true) while failedCount > 0 — i.e. some diffs in the group errored during review.

Common situations: LLM API outages or rate limits failing individual file reviews within a parallel group; a diff file too large to process; checkpoint criteria unmet because the group aborted midway.

Related errors


AI-assisted analysis of alibaba/open-code-review@5cf97d0d15 (2026-09-02). Data as JSON: /api/errors/f63970576a1d1c9f. Report an issue: GitHub.