Were you their supervisor/manager/lead? If so, the standard answer is to have regular 1:1s with your staff, so things like this do not come as a surprise.
And you cannot always keep everyone. Sometimes things really are not a fit. The last job I left was for reasons that had nothing to do with the team or product, or anything easily changeable. I simply wasn't OK with the commute to a new office. There are a myriad of personal reasons that someone might not want to work somewhere. That doesn't mean the company is flawed - it just means people are different, and have different preferences and needs.
I'd recommend spending less focus on why one person left, and more on ongoing discussions with the people who remain, as well as being sure new staff has every opportunity to learn about the company, so they can self-select out before they are hired if they see anything that would not work well for them.