The correct terminology to use here is that God is free from all limitations and flaws, not that He is infallible, because infallibility is a term used for other than Him. With that in mind, everything other than God is [categorized as] creation and is limited. The discussion regarding infallibility in its first stage is actually a response to the question: Can a human being who is the vicegerent of God prevail over the materialistic dimension [of his/her being] and live a life of virtue, purity, and infallibility?
Hence, infallibility here means that a human being, whilst having an animalistic instinct which can be the breeding place for oppression and evil, becomes absorbed in his/her inclination to divinity to the extent that through [actions chosen with] freewill he/she begins to reflect the characteristics and moral etiquettes of the angels.
This type of infallibility has levels and stages; at the most perfect and complete stage a person becomes immune and distant from all mistakes and deviations. The source for this type of infallibility is the light and recognition [of realities] bestowed upon the person by God. In essence, this is the rank of being Gods Vicegerent, that the Prophets and Awlīyā (friends and those close) of God have achieved, simply because they gave more importance to the love of God over the love of this world. It is also worth mentioning that the Prophets and Imāms, due to their roles as dissimulators of Gods message, apart from possessing this type of infallibility, also enjoyed greater God given immunity as a guarantee and protection for the divine message [that they had to deliver for the people].
Nonetheless, these great personalities, more than others, perceive themselves to be flawed and blemished in front of God to the extent that they do not imagine themselves needless of God even for less than a second.
That being said, it is possible for every human to attain perfection, even the sinful person who after repenting treads the path towards infallibility. Just as achieving infallibility without having committed any previous sins is highly valued, in the same way infallibility after having been sinful is also admired and esteemed. No person is exempt from this rule, as God loves those who repent (do note, that this is in relation to voluntary infallibility and differs from endowed infallibility).
Many of Gods special Awlīyā (close and chosen ones) have been successful in attaining this level with His help and attention.
Put simply, human beings through continuously acting upon their own freewill are making themselves prisoners to their desires, and no matter how hard they try, they will never be safe from the deception of their Nafs (the carnal soul). However, if one surrenders their whole will and existence to God or the Imāms, they have given up their own will and thereafter, their every action will be in accordance to the will of their master. Such a stage cannot be perceived except at the level of [true] love and complete absorption (in God).