Thank you for checking out my issue.
I changed the XYZ used in the NewFamilyInstance to use the connector origin instead of the pipe face center but they have the exact same XYZ:
pipefacecenterXYZ = list(UnwrapElement(wpipe).ConnectorManager.UnusedConnectors)[0].Origin
pipeconnectorXYZ = list(pipe.ConnectorManager.UnusedConnectors)[0]
verifying pipefacecenterXYZ.DistanceTo(pipeconnectorXYZ) I get 0. So I know that the pipe connector is really at the face center.
But then I verify my plumbing fixture connector and the distance to the pipe connector, I get something weird for the pipe I showed in my forst video:
(list(MagicConnector.MEPModel.ConnectorManager.UnusedConnectors)[0].Origin).DistanceTo(pipeconnectorXYZ)/304.8 = 2.0588462975328
So I tried this test with another pipe where the script actually works without an error (as in my second video) and I got that:
(list(MagicConnector.MEPModel.ConnectorManager.UnusedConnectors)[0].Origin).DistanceTo(pipeconnectorXYZ)/304.8 = 2.1817385470803
But everything still works. So I will assume that this distance isn't the source of the problem.
Also checked the family to make sure that the connector was created on the plumbing fixture's origin:
My last assumption is that the problem would be caused by the vertical orientation of the pipes. I only get an error for pipes that have disconnected ends in the vertical position.