An easy fix, but it will require you unscrewing the buffer tube a bit to get the new spring and retainer in. That will require loosening of the castle nut, a special wrench for this is recommended, though you might be able to wing it with some slip joint pliers. YouTube has some excellent videos showing the process. It really is easy.
My guess is the buffer tube was probably never seated deep enough to hold the retainer in place.