When I run my function with debugging enabled I get the following. However, upon checking the results, it seems the function did complete as expected, but throws the error at the end.
If I run my function without debugging, everything completes just fine.
Both execute fine, but in the UI with debugging enabled, something about my function is causing this error. Perhaps it is the size of debugging information being captured.