Animator Breaking

This keeps happening and I dont really know why. Ill be doing whatever editing or testing, it doesnt really seem to matter what im doing, and then the animator just breaks. It says theres a nullreferenceexception with “UnityEditor.Graphs.Edge.Wakeup()” at some really long string of numbers and letters. Then it also says theres another nullreferenceexception at “UnityEditor.Graphs.AnimationStateMachine.Graph.GenerateConnectionKey”.

I dont know why it happens but it breaks my animator and causes all of the states and transitions between states just dissapear, and i cannot create any new states. The grid just becomes empty. I can restart unity and that does fix it, but only for a few minutes and then it breaks again.