Vessels escaping host bodies over time

Solution 1:

That is most likely stemming from floating-point precision.

Whenever you load a vessel, the path gets loaded with the maximum precision from the file. However, the path data it handles on an active vessel is in a different coordinate system. When saving the vessel to inactive or swapping to time-warp, those coordinates get converted again, and somewhere at the end one of the decimals can get truncated. The more often a vessel is loaded, the more the error accumulates - and it happens at least once for each vessel. The tiny error created when unfocusing the craft already can throw off the path enormously over the course of decades.

This error was much worse before they rewrote much of the code for Unity 5 so they could use 64-bit variables in version 1.1, yet it is almost impossible to eliminate completely as the error will accumulate whenever the vessel is reread and saved. But you are lucky: it takes longer now. For example in 0.25 floating point error would crash your active vessel on a perfectly circular orbit into a moon within a few minutes.

But fret not: if you know what your vessel's orbit exactly should be... Scott Manley has an explanation for you how to alter your vessel data that still works 8 years later.