From 80b538e312c173d124fdcb91d40285b32e80d0a9 Mon Sep 17 00:00:00 2001 From: Patrick Devine Date: Wed, 23 Jul 2025 22:16:55 -0700 Subject: [PATCH] cli: catch upstream errors gracefully (#11512) --- cmd/cmd.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/cmd.go b/cmd/cmd.go index 7955012c85..1d1d116ba0 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -1137,6 +1137,14 @@ func chat(cmd *cobra.Command, opts runOptions) (*api.Message, error) { if errors.Is(err, context.Canceled) { return nil, nil } + + // this error should ideally be wrapped properly by the client + if strings.Contains(err.Error(), "upstream error") { + p.StopAndClear() + fmt.Println("An error occurred while processing your message. Please try again.") + fmt.Println() + return nil, nil + } return nil, err }