There are two common causes leading to Selenium StaleElementReferenceException which have been highlighted in Selenium documentation as well-
The referenced element is not attached to the DOM anymore.
The referenced element has been deleted permanently.