alibaba/open-code-review · error
grouping LLM call: %w
Error message
grouping LLM call: %w
What it means
In callGroupingLLM, after CompletionsWithCtx returns an error, the task record is marked failed and the error is wrapped as "grouping LLM call". This is the grouping-stage analogue of a plan/request failure: the LLM call that groups changed files into review groups did not complete.
Source
Thrown at internal/agent/grouping.go:220
})
}
if maxTokens <= 0 {
maxTokens = 4096
}
resp, err := client.CompletionsWithCtx(ctx, llm.ChatRequest{
Model: modelName,
Messages: messages,
MaxTokens: maxTokens,
})
duration := time.Since(startTime)
if err != nil {
if rec != nil {
rec.SetError(err, duration)
}
return nil, nil, fmt.Errorf("grouping LLM call: %w", err)
}
usage = resp.Usage
content := resp.Content()
if content == "" {
if rec != nil {
rec.SetError(fmt.Errorf("grouping LLM returned empty response"), duration)
}
return nil, usage, fmt.Errorf("grouping LLM returned empty response")
}
groups, err = parseGroupingResponse(content, diffs)
if rec != nil {
if err != nil {
rec.SetError(fmt.Errorf("grouping response parse failed: %w", err), duration)
} else {
rec.SetResponse(resp, duration)View on GitHub (pinned to 5cf97d0d15)
Solutions
- Unwrap the error to see the provider/HTTP cause (401/429/timeout).
- Fix LLM configuration (API key, model, endpoint) and verify with a single small request.
- For rate limits or timeouts, retry with backoff or reduce MaxTokens/group size.
- Check network egress (proxy, firewall, DNS) if errors are connection-level.
Example fix
// before: 'grouping LLM call: 429 too many requests' ocr review # immediate retry after burst // after: wait/backoff, or lower concurrency, then re-run sleep 30 && ocr review --resume
Defensive patterns
Strategy: retry
Validate before calling
// pre-flight: cheap completion to validate key/endpoint before grouping
if err := pingLLM(client, model); err != nil { return err } Try / catch
groups, usage, err := callGroupingLLM(ctx, diffs, client, model, task, maxTokens, opts)
if err != nil {
if isTransient(err) { // 429/timeout/network
time.Sleep(backoff)
groups, usage, err = callGroupingLLM(ctx, diffs, client, model, task, maxTokens, opts)
}
} Prevention
- Add client-side timeout and retry policies for the grouping request.
- Validate API keys and endpoints before large reviews.
- Reduce grouping prompt size for big change sets to avoid rate limits.
- Resume the session after fixing the cause instead of re-reviewing from scratch.
When it happens
Trigger: groupDiffs → callGroupingLLM when the LLM client returns an error: auth failure, network error, rate limit, timeout, or context cancellation during the grouping request.
Common situations: Invalid API key, provider outage, request exceeding timeout, 429 rate limit on repos with many changed files, proxy blocking the API host.
Related errors
- llm request failed: %w
- plan request: %w
- scan failed: %w
- all %d file review(s) failed — check your LLM configuration
- grouping LLM panicked: %v
AI-assisted analysis of alibaba/open-code-review@5cf97d0d15 (2026-09-02).
Data as JSON: /api/errors/2b87413cb33aacaa.
Report an issue: GitHub.