Skip to content

Commit 375ee41

Browse files
authored
Merge pull request #2345 from rumpl/nicer-message
Nicer message
2 parents 7801c53 + 6e18403 commit 375ee41

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

pkg/runtime/fallback.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,13 +324,17 @@ func (r *LocalRuntime) tryModelWithFallback(
324324
// If the last error (or any error in the chain) was a context overflow,
325325
// wrap it in a ContextOverflowError so the caller can auto-compact.
326326
if lastErr != nil {
327-
wrapped := fmt.Errorf("all models failed: %w", lastErr)
327+
prefix := "model failed"
328+
if hasFallbacks {
329+
prefix = "all models failed"
330+
}
331+
wrapped := fmt.Errorf("%s: %w", prefix, lastErr)
328332
if modelerrors.IsContextOverflowError(lastErr) {
329333
return streamResult{}, nil, modelerrors.NewContextOverflowError(wrapped)
330334
}
331335
return streamResult{}, nil, wrapped
332336
}
333-
return streamResult{}, nil, errors.New("all models failed with unknown error")
337+
return streamResult{}, nil, errors.New("model failed with unknown error")
334338
}
335339

336340
// retryDecision is the outcome of handleModelError.

0 commit comments

Comments
 (0)