I'm having this error suddenly as well. When the aircraft performs a quick YAW in any direction, a compass error forces ATTI mode.
The issue for me is that I'm flying pre-programmed mapping missions and when the aircraft changes directions the shift to ATTI mode causes the mission to abort...