Inspect the chain, each link.
"Once upon a time", I had an instance where the chain fell off the front small ring while climbing in the biggest gear of the cassette. It didn't happen otherwise. I noticed there was a link in the chain that wasn't 100% pinned properly, and under heavy load (climbing) and with the chain at an angle (in the biggest gear of the cassette), the link would twist and self-derail off the inside of the small ring.