Each time has been on different aircraft models, but there's not a lot of variation in nose wheel retraction design on airliners. There's a myriad of ways something could go wrong to make it happen, but considering how many flights there are per day, it's still an extremely rare event.
QA engineer's first check was, what happens if I try and retract the wheels while the plane is sitting on the ground and not moving. Oops.