If you checked the horizon and did your best to know the time of Maghreb, then later it appeared that you broke your fast a few minutes earlier, your fast is valid. But if you broke your fast a few minutes earlier because you thought maghreb has set it but then it appeared it didn’t, you did not commit a sin but you have to make up this day later, and you don’t have to pay any kaffara.