Why do the Imams ask for forgiveness in supplications
An excerpt from the introduction of Minhāj al-Ḥayāh fī al-Adʿiyah wa al-Ziyārāt (p. 23) by Ayatollah Muhammad Hadi Yusufi Gharawi
The dhunūb (sins) are of 2 types: real dhunūb, meaning acts which oppose divine orders and prohibitions, and relative or supplemental sins, meaning any act which when taking into account the (high) position and personality of the one who carries it out, do not befit him, and what is agreed upon is that the first type here cannot be committed by the infallibles (as).
But as for the second type - which is referred to in ʿilm al-kalām as "abandoning the better option" (tark al-awlā) - it is possible that the infallibles (as) commit such act. And if such actions are not forgiven for their doer, their recompense is in proportion to it (the action). For the trials that the prophets have went through - such as the trials undergone by Prophet Yaʿqūb (as) when separated from Yūsuf (as) by the long term imprisonment, and the trials of Prophet Yūnus (as) in the belly of the whale, are of this type of punishment.
So we say: it is possible that the Prophet or the Imam commits an act which according the sharʿī rulings and the general laws is not ḥarām nor makrūh, but rather it does not suit their rank and stations, something which does not befit them, for example if an infallible person spends a portion of their time without keeping busy with their function, or he leaves some of the recommended acts - even if he is doing a lesser recommended act - which in turn makes him see his act as if it is an offence and contrary to his manners (adab), so he considers it as having oppressed himself, so he is affected by it and could weep over it.
And so we say: the source of the statement of the infallibles regarding dhunūb and their seeking forgiveness or their seeking repentance and similar things is not like the dhunūb that others commit, and it was because of their being aware of their stations of wilāyah and infallibility, and they used to say that the one who holds such position is safeguarded from major and minor dhunūb.