diff --git a/internal/net/grpc/stream.go b/internal/net/grpc/stream.go index f91d3964211..4c536abad69 100644 --- a/internal/net/grpc/stream.go +++ b/internal/net/grpc/stream.go @@ -64,10 +64,7 @@ func BidirectionalStream(ctx context.Context, stream grpc.ServerStream, errs = errors.Wrap(errs, err.Error()) gerr := status.FromError(err) if gerr != nil { - if gerrs == nil { - gerrs = gerr - return true - } + } else if msg, ok := m.(string); ok { hostname, err := os.Hostname() if err != nil { @@ -79,9 +76,17 @@ func BidirectionalStream(ctx context.Context, stream grpc.ServerStream, Instance: hostname, } } - if gerr != nil { - gerrs.Roots = append(gerrs.Roots, gerr) + if gerr == nil { + return true + } + if gerrs == nil { + gerrs = gerr + return true + } + if gerrs.Roots == nil { + gerr.Roots = make([]*errors.Errors_RPC, concurrency) } + gerrs.Roots = append(gerrs.Roots, gerr) return true }) st, err := status.New(status.Unknown, errs.Error()).WithDetails(gerrs)