I have a hosted feature layer containing a point layer with several related tables.
I'm using Arcade to calculate the total number of related records per point, populating a new empty field. I have 9 empty fields which I am doing calculations on but I'm encountering an unexpected behavior with Arcade.
Sometimes the calculation works and sometimes it doesn't. I'm positive the syntax I'm using is correct since I was able to successfully calculate for 5 out of 9 fields I have. The problem is I have to run Arcade several times as I keep getting this error:

After n number of tries for the 5 fields, I was able to get the values I needed. But still no success with the remaining 4 fields I have. I keep on running Arcade until the calculation is successful.
Is this unexpected behavior a bug or is it something that can be fixed on the server side? Has anyone experienced this in portal? Hope someone can help. Thanks!