It wasn’t CarMax’s fault. They can’t predict failure before it happens.
These types of issues happen to used cars. Some brands are worse than others and you didn’t bother to tell us the brand.
I’ve bought 2 cars from CarMax and sold them 2. Good experiences all around.