It's happened to me a couple of times. This is a one piece type crank? The problem happens is when the bearings are placed in the chainring side of the bearing cup in the frame. As the crank assembly is put through the frame, the bearings come out of place very slightly and then the cranks are tightened down and adjusted. Then as you pedal, the bearings get set properly in the cup, making the whole assembly a little looser and the bearing retainer may have been bent slightly, allowing the bearings to come free. Now I always doublecheck the chainside bearing to make sure it's set properly in the cup. After a first ride, I'll recheck the bearings for adjustment.