File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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.
You can’t perform that action at this time.
0 commit comments