I get an error while generating the network diagrams when I feed the diagram a trace result.

If I run the generate diagram command on a simple selection, everything works, but as soon as I run a trace, like a subnetwork or connected trace, and feed the result to OOB options or custom functions, things start failing with the above error.
Can anyone help me on this?