alibaba/open-code-review · error

all %d file review(s) failed — check your LLM configuration

Error message

all %d file review(s) failed — check your LLM configuration and API key

What it means

dispatchSubtasks counts dispatched file-review subtasks and their failures. When every dispatched review failed and no comments were reused or collected, the agent returns this error instead of an empty result. It is a client-side summary: the underlying per-file errors (LLM API failures) are recorded per task, and this top-level error tells you the LLM pipeline produced nothing usable.

Source

Thrown at internal/agent/agent.go:819

	if dispatched == 0 {
		return a.args.CommentCollector.Comments(), nil
	}

	failed := atomic.LoadInt64(&a.subtaskFailed)
	reused := int64(0)
	if a.resumeInfo != nil {
		reused = a.resumeInfo.ReusedFiles
	}
	// A resumed run can still have usable coverage when every newly dispatched
	// subtask hard-fails. Preserve the legacy all-failed error only when there is
	// no reused result; otherwise the manifest is partial and must exit 0.
	if failed > 0 && failed == dispatched && reused == 0 {
		// Even when all subtasks failed, some may have produced comments before
		// hitting the error. Return those comments instead of discarding them.
		if comments := a.args.CommentCollector.Comments(); len(comments) > 0 {
			return comments, nil
		}
		return nil, fmt.Errorf("all %d file review(s) failed — check your LLM configuration and API key", dispatched)
	}

	return a.args.CommentCollector.Comments(), nil
}

func (a *Agent) recordContextFailure(err error) {
	if b := a.session.Manifest(); b != nil {
		var setErr error
		if errors.Is(err, context.DeadlineExceeded) {
			// A deadline truncates pending coverage without overriding completed items.
			setErr = b.SetPendingFailureCause(session.FailureTimeout, "review deadline exceeded")
		} else {
			// Explicit cancellation stops the run itself, not just its pending items.
			setErr = b.SetRunFailure(session.RunFailureCancelled, "review was cancelled")
		}
		if setErr != nil {
			a.recordWarning("manifest_error", "", setErr.Error())
		}

View on GitHub (pinned to 5cf97d0d15)

Solutions

  1. Check the per-file errors in the session/manifest output to see the actual LLM failure cause.
  2. Verify the LLM API key, provider, endpoint and model configuration (env vars/config file).
  3. Test connectivity: `curl` the provider endpoint or run a single-file review to isolate network issues.
  4. Check quota/rate limits on the provider dashboard and retry after resolving; resume the session to avoid re-reviewing completed files.

Example fix

// before
export OPENAI_API_KEY=sk-old-expired
ocr review
// -> all 5 file review(s) failed — check your LLM configuration and API key
// after
export OPENAI_API_KEY=sk-valid-current-key
ocr review --resume
Defensive patterns

Strategy: fallback

Validate before calling

// pre-flight: verify LLM config before dispatching
if os.Getenv("LLM_API_KEY") == "" { return fmt.Errorf("missing LLM_API_KEY") }
// optional: ping the endpoint with a tiny completion first

Try / catch

comments, err := agent.Run(ctx)
if err != nil && strings.Contains(err.Error(), "file review(s) failed") {
    // inspect per-file errors in the session/manifest, fix config, then resume
    return fmt.Errorf("review aborted: %w (resume with --resume to skip completed files)", err)
}

Prevention

When it happens

Trigger: Agent.Run() where all dispatched per-file review subtasks returned errors (LLMClient failures: auth, network, rate limit, timeout) and CommentCollector has zero comments and no reused items.

Common situations: Expired or wrong API key, missing model name, wrong provider endpoint, corporate proxy blocking the API, quota exhausted, request context cancelled before any file completed.

Related errors


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