Kindly refer to the link below for detailed answer to your very important question
https://www.al-islam.org/shia-rebuts-sayyid-rida-husayni-nasab/question-6-why-do-you-regard-your-imams-as-infallible-masum
https://www.imamreza.net/old/eng/imamreza.php?id=13163