When I run the following code with the outFC creation path set to a feature dataset inside a file geodatabase...
arcpy.XYToLine_management(tempFC, outFC, "POINT_X", "POINT_Y", "NEAR_X", "NEAR_Y", "GEODESIC", "", formatSpatialRef)
...I get the following message:
ERROR 000582: Error occurred during execution.
The script runs without errors when I set the outFC creation path to the root level of the gdb. Spatial references for the feature dataset and the output FC are identical. I'm wondering if this is a case of a built-in behavior similar to what is described in this posting: