@Serrof and @luc
Turned out the issue stemmed from the event detector causing the propagator to use a variable but very small step size near the apsides. This led to numerical errors in another routine that I am using that relies on acos()
.
As @Serrof had suggested, i modified the integration variables to equinoctial elements as opposed to using Cartesian. And including a check to ignore numerical errors of 1E-12 order or less in the other function helped solve the issue.