So a plane which has withstood probably countless landings, had its nose gear collapse while sitting statically at a gate of all times and places? Weird.
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.
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.